Function opentelemetry::global::meter_with_version

source ·
pub fn meter_with_version(
    name: impl Into<Cow<'static, str>>,
    version: Option<impl Into<Cow<'static, str>>>,
    schema_url: Option<impl Into<Cow<'static, str>>>,
    attributes: Option<Vec<KeyValue>>,
) -> Meter
Expand description

Creates a Meter with the name, version and schema url.

  • name SHOULD uniquely identify the instrumentation scope, such as the instrumentation library (e.g. io.opentelemetry.contrib.mongodb), package, module or class name.
  • version specifies the version of the instrumentation scope if the scope has a version
  • schema url specifies the Schema URL that should be recorded in the emitted telemetry.

This is a convenient way of global::meter_provider().versioned_meter(...)

§Example

use opentelemetry::global::meter_with_version;
use opentelemetry::KeyValue;

let meter = meter_with_version(
    "io.opentelemetry",
    Some("0.17"),
    Some("https://opentelemetry.io/schemas/1.2.0"),
    Some(vec![KeyValue::new("key", "value")]),
);