Module opentelemetry_semantic_conventions::resource

source ·
Expand description

§Resource Semantic Conventions

The resource semantic conventions define a set of standardized attributes to be used in Resources.

§Usage

use opentelemetry::KeyValue;
use opentelemetry_sdk::{trace::{config, TracerProvider}, Resource};
use opentelemetry_semantic_conventions as semconv;

let _tracer = TracerProvider::builder()
    .with_config(config().with_resource(Resource::new(vec![
        KeyValue::new(semconv::resource::SERVICE_NAME, "my-service"),
        KeyValue::new(semconv::resource::SERVICE_NAMESPACE, "my-namespace"),
    ])))
    .build();

Re-exports§