opentelemetry-instrumentation-actix-web

Crates.ioopentelemetry-instrumentation-actix-web
lib.rsopentelemetry-instrumentation-actix-web
version0.22.0
created_at2025-05-28 14:59:44.47041+00
updated_at2025-05-28 14:59:44.47041+00
descriptionOpenTelemetry instrumentation for Actix Web apps
homepagehttps://github.com/open-telemetry/opentelemetry-rust-contrib/tree/main/actix-web-opentelemetry
repositoryhttps://github.com/open-telemetry/opentelemetry-rust-contrib/tree/main/actix-web-opentelemetry
max_upload_size
id1692894
size283,175
rust-publishers (github:open-telemetry:rust-publishers)

documentation

README

OpenTelemetry Actix Web Instrumentation

OpenTelemetry — An observability framework for cloud-native software.

OpenTelemetry instrumentation for Actix Web.

Crates.io: actix-web-opentelemetry Documentation LICENSE GitHub Actions CI Slack

Exporter configuration

actix-web uses tokio as the underlying executor, so exporters should be configured to be non-blocking:

[dependencies]
# if exporting to jaeger, use the `tokio` feature.
opentelemetry-jaeger = { version = "..", features = ["rt-tokio-current-thread"] }

# if exporting to zipkin, use the `tokio` based `reqwest-client` feature.
opentelemetry-zipkin = { version = "..", features = ["reqwest-client"], default-features = false }

# ... ensure the same for any other exporters

Execute client and server example

# Run jaeger in background
$ docker run -d -p6831:6831/udp -p6832:6832/udp -p16686:16686 jaegertracing/all-in-one:latest

# Run server example with tracing middleware
$ cargo run --example server
# (In other tab) Run client example with request tracing
$ cargo run --example client --features awc

# View spans (see the image below)
$ firefox http://localhost:16686/

Jaeger UI

Features

  • awc -- enable support for tracing the awc http client.
  • metrics -- enable support for opentelemetry metrics (only traces are enabled by default)
  • sync-middleware -- enable tracing on actix-web middlewares that do synchronous work before returning a future. Adds a small amount of overhead to every request.
Commit count: 1014

cargo fmt