From cfd4ef95e635dd16780ba165882de3d7abfb60d8 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Thu, 24 Oct 2024 16:45:52 -0700 Subject: [PATCH 1/3] initial commit --- opentelemetry-sdk/src/metrics/pipeline.rs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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,) + ); } } } From 2154a16a223e5964fe5e036d4dee7ecaa7ae56fc Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Sat, 26 Oct 2024 12:40:27 -0700 Subject: [PATCH 2/3] use otel_debug --- opentelemetry-sdk/src/metrics/pipeline.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opentelemetry-sdk/src/metrics/pipeline.rs b/opentelemetry-sdk/src/metrics/pipeline.rs index 88f01a9bed..703e204e6a 100644 --- a/opentelemetry-sdk/src/metrics/pipeline.rs +++ b/opentelemetry-sdk/src/metrics/pipeline.rs @@ -7,7 +7,7 @@ use std::{ use opentelemetry::{ metrics::{MetricsError, Result}, - otel_warn, InstrumentationScope, KeyValue, + otel_debug, InstrumentationScope, KeyValue, }; use crate::{ @@ -414,7 +414,7 @@ where } // 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!( + otel_debug!( name: "Instrument.DuplicateMetricStreamDefinitions", message = "duplicate metric stream definitions", reason = format!("names: ({} and {}), descriptions: ({} and {}), kinds: ({:?} and {:?}), units: ({:?} and {:?}), and numbers: ({} and {})", From f99756a9736fb8a30a354a85dc853cddadaab7ae Mon Sep 17 00:00:00 2001 From: Lalit Date: Sat, 26 Oct 2024 21:51:49 -0700 Subject: [PATCH 3/3] lint --- opentelemetry-sdk/src/metrics/pipeline.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentelemetry-sdk/src/metrics/pipeline.rs b/opentelemetry-sdk/src/metrics/pipeline.rs index aa2ed16cf4..acf4605d13 100644 --- a/opentelemetry-sdk/src/metrics/pipeline.rs +++ b/opentelemetry-sdk/src/metrics/pipeline.rs @@ -6,7 +6,7 @@ use std::{ }; use opentelemetry::{ - metrics::MetricError + metrics::{MetricError, MetricResult}, otel_debug, InstrumentationScope, KeyValue, };