From cee9c77d2c07b97a46908c1d2f1f8fa0f0e184e0 Mon Sep 17 00:00:00 2001 From: bryn Date: Fri, 1 Sep 2023 16:35:28 +0100 Subject: [PATCH] Metric should not be counted as errors for metrics --- apollo-router/src/plugins/telemetry/metrics/layer.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apollo-router/src/plugins/telemetry/metrics/layer.rs b/apollo-router/src/plugins/telemetry/metrics/layer.rs index f19c1cd6916..e853b80f678 100644 --- a/apollo-router/src/plugins/telemetry/metrics/layer.rs +++ b/apollo-router/src/plugins/telemetry/metrics/layer.rs @@ -336,7 +336,10 @@ impl<'a> Visit for MetricVisitor<'a> { } fn record_str(&mut self, field: &Field, value: &str) { - if let Some(metric_name) = field.name().strip_prefix(METRIC_PREFIX_MONOTONIC_COUNTER) { + if field.name() == "message" { + return; + } else if let Some(metric_name) = field.name().strip_prefix(METRIC_PREFIX_MONOTONIC_COUNTER) + { tracing::error!( metric_name, "monotonic counter must be u64 or f64. This metric will be ignored" @@ -367,7 +370,10 @@ impl<'a> Visit for MetricVisitor<'a> { } fn record_debug(&mut self, field: &Field, value: &dyn fmt::Debug) { - if let Some(metric_name) = field.name().strip_prefix(METRIC_PREFIX_MONOTONIC_COUNTER) { + if field.name() == "message" { + return; + } else if let Some(metric_name) = field.name().strip_prefix(METRIC_PREFIX_MONOTONIC_COUNTER) + { tracing::error!( metric_name, "monotonic counter must be u64 or f64. This metric will be ignored"