OpenTelemetry metrics in Dynatrace
There are six instruments available in OpenTelemetry that can be used to produce measurements:
- Counter
- Asynchronous Counter
- Histogram
- Asynchronous Gauge
- UpDownCounter
- Asynchronous UpDownCounter
The OpenTelemetry SDKs are capable of producing metrics that do not map 1:1 to Dynatrace metrics. The table below shows how OpenTelemetry metrics map to Dynatrace metrics.
OpenTelemetry Instrument | Aggregation Temporality | Dynatrace |
---|---|---|
Counter | Delta | Counter |
Counter | Cumulative | Not supported |
UpDownCounter | Delta | Counter |
UpDownCounter | Cumulative | Gauge |
Histogram | Delta | Not supported |
Histogram | Cumulative | Not supported |
Asynchronous Gauge | - | Gauge |
Aggregation temporality
Temporality refers to the way additive quantities are expressed in relation to time, indicating whether reported values incorporate previous measurements. OpenTelemetry also defines a notion of aggregation. To learn more about it see Aggregation.
There are two types of aggregation temporalities that can be associated with each metric type.
- Delta temporality: reported values do not include previous measurements
- Cumulative temporality: reported values include previous measurements
What does Dynatrace recommend?
When configuring aggregation temporality manually, Dynatrace recommends the following:
- For Counter, Asynchronous Counter, and Histogram: Delta
- For UpDownCounter and Asynchronous UpDownCounter: Cumulative
Note that Gauges are not mentioned here because they do not have an aggregation temporality.
How can I configure aggregation temporality manually?
Aggregation temporality can be configured manually either in code (using the OpenTelemetry SDK) or via the environment variable OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
(with the value delta
). Refer to our language guides for help.
Note that support for the environment variable OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
is not obligatory for language SDKs. At this time, only Java and Python support it.
See the OpenTelemetry compliance matrix for more information.
Aggregation
An Aggregation specifies an operation (such as Sum, Histogram, Min, Max, and Count) that will be applied to measurements.
It can be configured via a view. It tells the SDK how to compute aggregated metrics from incoming instrument measurements (it takes a series of measurements and expresses them as a single metric value at that point in time).
Aggregation default configuration parameters can be overwritten by optional configuration parameters.
In the following example, a Histogram is configured with an Explicit Bucket Aggregation and custom boundaries.
meterProviderBuilder
.AddView(
instrumentName: "my-histogram",
aggregation: new ExplicitBucketHistogramAggregation(
boundaries: new double[] { 0.0, 10.0, 100.0 }
)
);
Aggregation operations
In addition to the above, the OpenTelemetry Metrics SDK provides five different aggregation operations:
- Drop: ignore or drop all instrument measurements for this aggregation.
- Default: use the default aggregation and configuration parameters defined for the specific instrument kind.
- Sum: collect the arithmetic sum of measurement values over a given time window. Used for Sums.
- Last Value: collect the last measurement along with its timestamp. Used for Gauges.
- Histogram: there are two different variations of the Histogram aggregation types (Exponential Bucket Histogram and Explicit Bucket Histogram). Both of them collect the following:
- A count of measurement values in population
- Arithmetic sum of measurement values in population
- Minimum measurement value in population (optional)
- Maximum measurement value in population (optional)
OpenTelemetry provides default aggregation for all instrument types. The defaults will work with Dynatrace out-of-the-box. For more information, see OpenTelemetry default aggregation.