Crates.io | actix-web-opentelemetry |
lib.rs | actix-web-opentelemetry |
version | 0.19.0 |
source | src |
created_at | 2019-11-20 00:14:24.215917 |
updated_at | 2024-09-22 16:25:14.163591 |
description | OpenTelemetry integration for Actix Web apps |
homepage | https://github.com/OutThereLabs/actix-web-opentelemetry |
repository | https://github.com/OutThereLabs/actix-web-opentelemetry |
max_upload_size | |
id | 182577 |
size | 277,685 |
OpenTelemetry integration for Actix Web.
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
# 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/
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.