diff --git a/.changesets/fix_geal_fix_datadog_histograms.md b/.changesets/fix_geal_fix_datadog_histograms.md new file mode 100644 index 0000000000..43551a860a --- /dev/null +++ b/.changesets/fix_geal_fix_datadog_histograms.md @@ -0,0 +1,5 @@ +### Fix histograms metrics in OTLP ([Issue #2393](https://github.com/apollographql/router/issues/2493)) + +with the "inexpensive" metrics selector, histogram are only reported as gauges, and so they will be incorrectly interpreted when reaching Datadog + +By [@GEal](https://github.com/geal) in https://github.com/apollographql/router/pull/2564 \ No newline at end of file diff --git a/apollo-router/src/plugins/telemetry/metrics/otlp.rs b/apollo-router/src/plugins/telemetry/metrics/otlp.rs index 3d2aef22db..d4883a56be 100644 --- a/apollo-router/src/plugins/telemetry/metrics/otlp.rs +++ b/apollo-router/src/plugins/telemetry/metrics/otlp.rs @@ -1,4 +1,5 @@ use opentelemetry::sdk::export::metrics::aggregation; +use opentelemetry::sdk::metrics::selectors; use opentelemetry::sdk::Resource; use opentelemetry::KeyValue; use opentelemetry_otlp::HttpExporterBuilder; @@ -41,7 +42,9 @@ impl MetricsConfigurator for super::super::otlp::Config { Some(exporter) => { let exporter = opentelemetry_otlp::new_pipeline() .metrics( - opentelemetry::sdk::metrics::selectors::simple::inexpensive(), + selectors::simple::histogram([ + 0.001, 0.005, 0.015, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 1.0, 5.0, 10.0, + ]), aggregation::stateless_temporality_selector(), opentelemetry::runtime::Tokio, )