tracing-opentelemetry
tracing-opentelemetry copied to clipboard
Implement Display for SpanKind
Feature Request
Motivation
The documentation has the following paragraph under 'Semantic Conventions'
OpenTelemetry defines conventional names for attributes of common operations. These names can be assigned directly as fields, e.g. trace_span!("request", "otel.kind" = %SpanKind::Client, "url.full" = ..), and they will be passed through to your configured OpenTelemetry exporter. You can find the full list of the operations and their expected field names in the semantic conventions spec.
However, that doesn't seem to actually be possible currently because SpanKind doesn't implement Display. Please let me know if I'm missing something obvious though.
Proposal
Implement Display for SpanKind according to the open telemetry semantic conventions.
Alternatives
Update docs to use hardcoded otel.kind value or alternate, instead of SpanKind directly.
Just noticed that SpanKind is part of the core opentelemetry crate and not this one. I guess my question now is, is there another SpanKind that the docs are referring to? Or is there another way to get this compiling that I'm missing?
You can just use strings directly, e.g. trace_span!("request", "otel.kind" = "client", "url.full" = ..). The docs should really be updated to show that usage as the otel spec doesn't define a display format for span kind.