Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Oct 24, 2024
1 parent 0202299 commit cfd4ef9
Showing 1 changed file with 9 additions and 7 deletions.
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 std::{
};

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

use crate::{
Expand Down Expand Up @@ -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!(

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

View check run for this annotation

Codecov / codecov/patch

opentelemetry-sdk/src/metrics/pipeline.rs#L416-L418

Added lines #L416 - L418 were not covered by tests
name: "Instrument.DuplicateMetricStreamDefinitions",
message = "duplicate metric stream definitions",
reason = format!("names: ({} and {}), descriptions: ({} and {}), kinds: ({:?} and {:?}), units: ({:?} and {:?}), and numbers: ({} and {})",

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

View check run for this annotation

Codecov / codecov/patch

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

Added line #L421 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 426 in opentelemetry-sdk/src/metrics/pipeline.rs

View check run for this annotation

Codecov / codecov/patch

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

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

0 comments on commit cfd4ef9

Please sign in to comment.