otel-http
Framework-independent inbound HTTP server spans and context propagation.
axum-otel adapts these helpers to Axum. Application logging and provider
initialization belong to otel-logger and otel-init respectively.
This crate is split out of tracing-otel in the upcoming release. See the
migration guide for dependency,
feature, and import changes.
Features
There are no default features. dep: denotes an optional dependency; other
names in the table denote features of this crate.
| Feature | Public APIs | Enables |
|---|---|---|
fields |
fields request/header helpers and constants |
dep:http |
macros |
Root dyn_span! and dyn_event! macros |
dep:tracing |
http |
propagation context extraction and injection |
fields, dep:http, dep:opentelemetry, dep:opentelemetry-http |
context |
Current trace/span IDs and remote-parent attachment | http, dep:tracing, dep:tracing-opentelemetry |
span |
span::make_request_span |
context, macros |
Request spans
Dependency configuration for the upcoming release:
[]
= { = "0.34", = ["span"] }
= "1"
= "0.1"
use Request;
use make_request_span;
use Level;
let request = builder.uri.body.unwrap;
let span = make_request_span;
The customization callback runs once before the remote parent is applied. Framework adapters set route, peer address, span name, and span kind there. See HTTP span attributes for the shared schema.
The caller owns its tracing subscriber and OpenTelemetry propagator setup.
These helpers do not initialize providers or depend on otel-logger or
otel-init. The optional dependency feature opentelemetry-otlp from the old
package is removed; exporter construction belongs in the caller's dependencies.
License
MIT or Apache-2.0; see the repository's MIT and Apache licenses.