9 releases (4 breaking)

0.18.1 Mar 9, 2024
0.18.0 Mar 9, 2024
0.15.4 Feb 24, 2024
0.15.0 Nov 25, 2023
0.12.0-alpha.7 Jun 28, 2023

#592 in Debugging

Download history 97/week @ 2023-12-22 197/week @ 2023-12-29 96/week @ 2024-01-05 142/week @ 2024-01-12 267/week @ 2024-01-19 234/week @ 2024-01-26 722/week @ 2024-02-02 529/week @ 2024-02-09 716/week @ 2024-02-16 774/week @ 2024-02-23 572/week @ 2024-03-01 941/week @ 2024-03-08 534/week @ 2024-03-15 400/week @ 2024-03-22 400/week @ 2024-03-29 506/week @ 2024-04-05

1,990 downloads per month

CC0 license

38KB
623 lines

axum-tracing-opentelemetry

crates license crate version

Project Status: Active – The project has reached a stable, usable state and is being actively developed.

Middlewares and tools to integrate tonic + tracing + opentelemetry for client and server.

Really early, missing lot of features, help is welcomed.

  • Read OpenTelemetry header from the incoming requests
  • Start a new trace if no trace is found in the incoming request
  • Trace is attached into tracing's span

For examples, you can look at the examples folder.

Extract of client.rs:

    let channel = Channel::from_static("http://127.0.0.1:50051")
        .connect()
        .await?; //Devskim: ignore DS137138
    let channel = ServiceBuilder::new()
        .layer(OtelGrpcLayer::default())
        .service(channel);

    let mut client = GreeterClient::new(channel);

    //...

    opentelemetry::global::shutdown_tracer_provider();

Extract of server.rs:

    Server::builder()
        // create trace for every request including health_service
        .layer(server::OtelGrpcLayer::default().filter(filters::reject_healthcheck))
        .add_service(health_service)
        .add_service(reflection_service)
        //.add_service(GreeterServer::new(greeter))
        .add_service(GreeterServer::new(greeter))
        .serve_with_shutdown(addr, shutdown_signal())
        .await?;

TODO

Changelog - History

CHANGELOG.md

Dependencies

~11MB
~196K SLoC