Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions opentelemetry-sdk/src/metrics/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
};

use opentelemetry::{
global,
metrics::{MetricsError, Result},
InstrumentationScope, KeyValue,
otel_warn, InstrumentationScope, KeyValue,
};

use crate::{
Expand Down Expand Up @@ -413,15 +412,18 @@
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!(

Check warning on line 417 in opentelemetry-sdk/src/metrics/pipeline.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/pipeline.rs#L415-L417

Added lines #L415 - L417 were not covered by tests
name: "Instrument.DuplicateMetricStreamDefinitions",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure what is the action end users are expected to do when they see this.. If this is only for sdk maintainers to debug, then lets use debug level only. If keeping at Warn, then it should be actionable/descriptive.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

message = "duplicate metric stream definitions",
reason = format!("names: ({} and {}), descriptions: ({} and {}), kinds: ({:?} and {:?}), units: ({:?} and {:?}), and numbers: ({} and {})",

Check warning on line 420 in opentelemetry-sdk/src/metrics/pipeline.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/pipeline.rs#L420

Added line #L420 was not covered by tests
existing.name, id.name,
existing.description, id.description,
existing.kind, id.kind,
existing.unit, id.unit,
existing.number, id.number,
)))
existing.number, id.number,)

Check warning on line 425 in opentelemetry-sdk/src/metrics/pipeline.rs

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/pipeline.rs#L425

Added line #L425 was not covered by tests
);
}
}
}
Expand Down
Loading