Middlewares and tools to integrate axum + tracing + opentelemetry.
For examples, you can look at:
```rust //... use axumtracingopentelemetry::{ opentelemetrytracinglayer, // optional tools to init tracer (require features) CollectorKind, init_tracer };
fn init_tracing() {
let otel_tracer = init_tracer(CollectorKind::Otlp).expect("setup of Tracer");
let otel_layer = tracing_opentelemetry::layer().with_tracer(otel_tracer);
let subscriber = tracing_subscriber::registry()
//...
.with(otel_layer);
tracing::subscriber::set_global_default(subscriber).unwrap();
}
async fn main() -> Result<(), Box
fn app() -> Router {
// build our application with a route
Router::new()
.route("/health", get(health))
// opentelemetrytracinglayer setup TraceLayer
, that is provided by tower-http so you have to add that as a dependency.
.layer(opentelemetrytracinglayer())
}
async fn shutdownsignal() { //... opentelemetry::global::shutdowntracer_provider(); } ```