Function opentelemetry::global::meter_with_scope
source · 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(...)
§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);