#actix #actix-web #opentelemetry #jaeger #prometheus


OpenTelemetry integration for Actix Web apps

3 releases

✓ Uses Rust 2018 edition

0.1.2 Dec 2, 2019
0.1.1 Nov 26, 2019
0.1.0 Nov 20, 2019

#130 in Debugging

25 downloads per month

MIT license

515 lines

Actix Web OpenTelemetry

Crates.io: actix-web-opentelemetry Documentation License: MIT

OpenTelemetry integration for Actix Web.

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

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

Jaeger UI


Actix Web OpenTelemetry

OpenTelemetry integration for Actix Web.

This crate allows you to easily instrument client and server requests.

  • Client requests can be traced by using the with_tracing function.
  • Server requests can be traced by using the RequestTracing struct.

Client Request Example:

use actix_web::client;
use futures::Future;

fn execute_request(client: &client::Client) -> impl Future<Item = String, Error = ()> {
    actix_web_opentelemetry::with_tracing(client.get("http://localhost:8080"), |request| {
    .map_err(|err| eprintln!("Error: {:?}", err))
    .and_then(|mut res| {
            .map(|bytes| std::str::from_utf8(&bytes).unwrap().to_string())
            .map_err(|err| eprintln!("Error: {:?}", err))

Server middlware example:

use actix_web::{App, HttpServer, web};
use actix_web_opentelemetry::RequestTracing;
use opentelemetry::api;

fn init_tracer() {
    opentelemetry::global::set_provider(api::NoopProvider {});

fn main() -> std::io::Result<()> {
    HttpServer::new(|| {
            .service(web::resource("/").to(|| "Hello world!"))


~466K SLoC