Skip to content

Commit

Permalink
fix histogram metrics in OTLP (#2564)
Browse files Browse the repository at this point in the history
Fix #2493

with the inexpensive selector, histogram are only reported as gauges,
and so they will be incorrectly interpreted when reaching Datadog
  • Loading branch information
Geoffroy Couprie authored Feb 15, 2023
1 parent 7230a16 commit 47bf502
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changesets/fix_geal_fix_datadog_histograms.md
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion apollo-router/src/plugins/telemetry/metrics/otlp.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit 47bf502

Please sign in to comment.