opentelemetry_semantic_conventions

Module trace

Source
Expand description

§Trace Semantic Conventions

The trace semantic conventions define a set of standardized attributes to be used in Spans.

§Usage

use opentelemetry::KeyValue;
use opentelemetry::{global, trace::Tracer as _};
use opentelemetry_semantic_conventions as semconv;

let tracer = global::tracer("my-component");
let _span = tracer
    .span_builder("span-name")
    .with_attributes([
        KeyValue::new(semconv::trace::CLIENT_ADDRESS, "example.org"),
        KeyValue::new(semconv::trace::CLIENT_PORT, 80i64),
    ])
    .start(&tracer);

Re-exports§