axum-tracing-opentelemetry
Middlewares and tools to integrate axum + tracing + opentelemetry.
- Read OpenTelemetry header from incoming request
- Start a new trace if no trace found in the incoming request
- Trace is attached into tracing'span
For examples, you can look at:
- the examples folder
- davidB/sandbox_axum_observability: Sandbox to experiment axum and observability. This example shows also propagation of the trace between tracing span and service (via reqwest).
//...
use opentelemetry_tracing_layer;
async
async
To retrieve the current trace_id (eg to add it into error message (as header or attributes))
let trace_id = find_current_trace_id;
json!
History
0.5
- upgrade to opentelemetry 0.18
- breaking change: upgrade opentelemetry-jaeger to 0.17 (switch from PipelineBuiler to AgentPipeline)
0.4
- allow customization of tracer
- add tracer to export on stdout or stderr
- add tracer to export to nowhere (like
/dev/null) to allow to have trace_id and the opentelemetry span & metadata on log and http response (without collector)
0.3
- Allow customization of exporter pipeline
- Fix name of the root span (#6)
0.2
- First public release as a crate
0.1
- Code originally created at part of axum-extra Add OpenTelemetry middleware by davidpdrsn · Pull Request #769 · tokio-rs/axum
- Code copied and modified as part of davidB/sandbox_axum_observability: Sandbox to experiment axum and observability
- Published as a standalone crate with OK from original author