Metrics appearing multiple times even if emitted once. #4412
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
It looks like you're using ConsoleExporter which by default has a TemporalityPreference as Cumulative and not Delta. With Cumulative aggregation temporality, the MetricReader (ConsoleExporter in this case) would keep exporting the cumulated data for the metric with every collection. Metrics are reported for a certain duration. Note the start time and end time in the output. In case of Cumulative aggregation, the start time doesn't change and only the end time changes. ConsoleExporter is only meant to provide you a fair idea of how the metrics data get emitted. There are a lot of backend systems that accept Cumulative aggregated data, the most prominent being Prometheus. |
Beta Was this translation helpful? Give feedback.
-
Once the delta/cumulative is changed, review the usage of metrics dimensions. It looks like one of the dimension is "durationMs", which is a bad choice for dimension. Durations should be the metric value itself, and modelling it as dimension would easily cause data loss due to cardinality capping https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/metrics/customizing-the-sdk#changing-maximum-metricpoints-per-metricstream |
Beta Was this translation helpful? Give feedback.
It looks like you're using ConsoleExporter which by default has a TemporalityPreference as Cumulative and not Delta. With Cumulative aggregation temporality, the MetricReader (ConsoleExporter in this case) would keep exporting the cumulated data for the metric with every collection. Metrics are reported for a certain duration. Note the start time and end time in the output. In case of Cumulative aggregation, the start time doesn't change and only the end time changes.
ConsoleExporter is only meant to provide you a fair idea of how the metrics data get emitted. There are a lot of backend systems that accept Cumulative aggregated data, the most prominent being Prometheus.