Skip to content

Commit

Permalink
Add a minor log to help debug when Meter is obtained from noops (#2435)
Browse files Browse the repository at this point in the history
  • Loading branch information
cijothomas authored Dec 17, 2024
1 parent 967dc93 commit 9cf7a40
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions opentelemetry/src/metrics/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! runtime impact.
use crate::{
metrics::{InstrumentProvider, Meter, MeterProvider},
KeyValue,
otel_debug, KeyValue,
};
use std::sync::Arc;

Expand All @@ -25,7 +25,8 @@ impl NoopMeterProvider {
}

impl MeterProvider for NoopMeterProvider {
fn meter_with_scope(&self, _scope: crate::InstrumentationScope) -> Meter {
fn meter_with_scope(&self, scope: crate::InstrumentationScope) -> Meter {
otel_debug!(name: "NoopMeterProvider.MeterCreation", meter_name = scope.name(), message = "Meter was obtained from a NoopMeterProvider. No metrics will be recorded. If global::meter_with_scope()/meter() was used, ensure that a valid MeterProvider is set globally before creating Meter.");
Meter::new(Arc::new(NoopMeter::new()))
}
}
Expand Down

0 comments on commit 9cf7a40

Please sign in to comment.