Skip to content

Commit

Permalink
fix(telemetry): metrics overflow is logged as a warning rather than e…
Browse files Browse the repository at this point in the history
…rror (#5287)

Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
  • Loading branch information
bnjjj authored and lrlna committed Jun 3, 2024
1 parent d26abf2 commit d32bf36
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .changesets/fix_bnjjj_fix_5173.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Metrics overflow is logged as a warning rather than error ([Issue #5173](https://github.com/apollographql/router/issues/5173))

If a metric has too high a cardinality the following warning will be displayed as a warning instead of an errorl:

`OpenTelemetry metric error occurred: Metrics error: Warning: Maximum data points for metric stream exceeded/ Entry added to overflow`

By [@bnjjj](https://github.com/bnjjj) in https://github.com/apollographql/router/pull/5287
9 changes: 8 additions & 1 deletion apollo-router/src/plugins/telemetry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use http::StatusCode;
use multimap::MultiMap;
use once_cell::sync::OnceCell;
use opentelemetry::global::GlobalTracerProvider;
use opentelemetry::metrics::MetricsError;
use opentelemetry::propagation::text_map_propagator::FieldIter;
use opentelemetry::propagation::Extractor;
use opentelemetry::propagation::Injector;
Expand Down Expand Up @@ -1799,7 +1800,13 @@ fn handle_error_internal<T: Into<opentelemetry::global::Error>>(
::tracing::error!("OpenTelemetry trace error occurred: {}", err)
}
opentelemetry::global::Error::Metric(err) => {
::tracing::error!("OpenTelemetry metric error occurred: {}", err)
if let MetricsError::Other(msg) = &err {
if msg.contains("Warning") {
::tracing::warn!("OpenTelemetry metric warning occurred: {}", msg);
return;
}
}
::tracing::error!("OpenTelemetry metric error occurred: {}", err);
}
opentelemetry::global::Error::Other(err) => {
::tracing::error!("OpenTelemetry error occurred: {}", err)
Expand Down

0 comments on commit d32bf36

Please sign in to comment.