Skip to content

Commit

Permalink
Metric should not be counted as errors for metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
bryn committed Sep 1, 2023
1 parent a3484e2 commit cee9c77
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions apollo-router/src/plugins/telemetry/metrics/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit cee9c77

Please sign in to comment.