diff --git a/opentelemetry-sdk/src/metrics/pipeline.rs b/opentelemetry-sdk/src/metrics/pipeline.rs index a140f65dec..d73056e38e 100644 --- a/opentelemetry-sdk/src/metrics/pipeline.rs +++ b/opentelemetry-sdk/src/metrics/pipeline.rs @@ -6,9 +6,8 @@ use std::{ }; use opentelemetry::{ - global, metrics::{MetricsError, Result}, - KeyValue, + otel_warn, KeyValue, }; use crate::{ @@ -414,15 +413,18 @@ where if existing == id { return; } - - global::handle_error(MetricsError::Other(format!( - "duplicate metric stream definitions, names: ({} and {}), descriptions: ({} and {}), kinds: ({:?} and {:?}), units: ({:?} and {:?}), and numbers: ({} and {})", + // If an existing instrument with the same name but different attributes is found, + // log a warning with details about the conflicting metric stream definitions. + otel_warn!( + name: "Instrument.DuplicateMetricStreamDefinitions", + message = "duplicate metric stream definitions", + reason = format!("names: ({} and {}), descriptions: ({} and {}), kinds: ({:?} and {:?}), units: ({:?} and {:?}), and numbers: ({} and {})", existing.name, id.name, existing.description, id.description, existing.kind, id.kind, existing.unit, id.unit, - existing.number, id.number, - ))) + existing.number, id.number,) + ); } } }