Function meter_with_scope
pub fn meter_with_scope(scope: InstrumentationScope) -> Meter
Expand description
Creates a Meter
with the given instrumentation scope.
This is a simpler alternative to global::meter_provider().meter_with_scope(...)
NOTE: Calls to meter_with_scope()
return a Meter
backed by the global MeterProvider
configured during the method invocation.
If the global MeterProvider
is changed after getting Meter
instances from these calls, the Meter
instances returned will not reflect the change.
§Example
use std::sync::Arc;
use opentelemetry::global::meter_with_scope;
use opentelemetry::InstrumentationScope;
use opentelemetry::KeyValue;
let scope = InstrumentationScope::builder("io.opentelemetry")
.with_version("0.17")
.with_schema_url("https://opentelemetry.io/schema/1.2.0")
.with_attributes(vec![(KeyValue::new("key", "value"))])
.build();
let meter = meter_with_scope(scope);