There are various guidelines and recommendations to keep in mind when working with OpenTelemetry, as with almost any other area of software engineering.
For OpenTelemetry metrics, we recommend following these best practices.
We provide you with working instrumentation samples in selected languages as well as sample code in Java for all the OpenTelemetry instruments.
For more information, see OpenTelemetry instrument code samples.
Use descriptive names for instruments, keys, and dimensions. Descriptive names enhance observability, especially in case of an error, making root cause analysis more efficient.
For more information, check the OpenTelemetry documentation on metrics semantic conventions.
We recommend using gzip
compression.
For more information, see Performance.
We recommend a maximum payload size of 4 MB (the default limit).
If that limit is exceeded, the entire OTLP message is dropped.
Data points can be dropped if, for example, their keys do not match the expected syntax.
For more information, see OpenTelemetry metrics limitations.
The Collector is a vendor-agnostic tool for handling telemetry data.
For more information about the Collector, see Dynatrace Collector
We recommend using a batch processor. Batching helps to compress the data and reduce the number of outgoing connections required to transmit data, which helps you avoid being rate limited.
For more information, see Performance.
Dimensions are used in Dynatrace to help distinguish what is being measured in a specific data point.
For example, if you're measuring the number of requests an endpoint has received, you can use dimensions to split that metric into requests that went through (status code 200) and requests that failed (status code 500).
Your dimensions should be well-annotated (recognizable, readable, understandable), have a descriptive name, and provide good information.
In OpenTelemetry, dimensions are called attributes.
Not all aggregation temporalities are suitable for every instrument.
In most cases, the default aggregation recommended by OpenTelemetry will be the best match, so we recommend using the default aggregation. All OpenTelemetry default aggregations work with Dynatrace out of the box.
It is possible to adjust aggregation and aggregation temporality. However, we recommend using the delta aggregation temporality.
For more information on how OpenTelemetry instruments and metrics are received and mapped in Dynatrace, see Ingest OpenTelemetry metrics.
Apply the following guidelines when creating names for your metrics.
Be consistent when naming metrics and attributes, which includes nesting associated metrics in a hierarchical structure and sticking to consistent naming for common attributes.
When you rename a metric, try to avoid reusing the old metric name when you subsequently name other metrics.
Metrics that have their unit included in the OpenTelemetry metadata should not include the unit in their name.
The name of a metric should be pluralized only if the unit of the metric in question is a non-unit (such as operations or packets).
For topic-specific semantic conventions, see the Metrics Semantic Conventions OpenTelemetry documentation.
Choosing the correct instrument to report Measurements is critical to achieving better efficiency, easing consumption for the user, and maintaining clarity in the semantics of the metric stream.
OpenTelemetry documentation provides a way of choosing the correct instrument.
Based on your intention, you can apply the following guidelines.
To count is to record the delta value.
Counter
.UpDownCounter
.To measure is to report an absolute value.
Asynchronous Gauge
.Asynchronous Counter
.UpDownCounter
.