#prometheus #actix-web #open-telemetry #jaeger #api-bindings

deprecated actix-web-opentelemetry

Deprecated: 0.22.0 is the last release for this crate. Use opentelemetry-instrumentation-actix-web instead

33 releases (21 breaking)

0.22.0 Apr 2, 2025
0.21.0 Feb 14, 2025
0.20.1 Jan 20, 2025
0.19.0 Sep 22, 2024
0.1.1 Nov 26, 2019

#27 in #jaeger

Download history 7731/week @ 2025-01-12 20796/week @ 2025-01-19 24415/week @ 2025-01-26 20185/week @ 2025-02-02 16421/week @ 2025-02-09 15670/week @ 2025-02-16 21745/week @ 2025-02-23 18182/week @ 2025-03-02 18211/week @ 2025-03-09 16591/week @ 2025-03-16 13614/week @ 2025-03-23 8409/week @ 2025-03-30 17359/week @ 2025-04-06 17685/week @ 2025-04-13 18975/week @ 2025-04-20 13177/week @ 2025-04-27

67,378 downloads per month
Used in 17 crates (5 directly)

Apache-2.0

180KB
817 lines

Actix Web OpenTelemetry

Crates.io: actix-web-opentelemetry Documentation LICENSE Slack

OpenTelemetry integration for Actix Web.

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 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)
  • metrics-prometheus -- enable support for prometheus metrics (requires metrics feature)
  • 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.

Dependencies

~18–31MB
~522K SLoC