14 stable releases

3.4.0 Jun 3, 2024
3.2.3 Aug 12, 2022
3.2.2 Jul 15, 2022
3.2.0 Oct 27, 2021
1.0.1 Dec 22, 2020

#265 in Web programming

Download history 257/week @ 2024-07-27 83/week @ 2024-08-03 12/week @ 2024-08-10 4/week @ 2024-08-17 144/week @ 2024-08-31 86/week @ 2024-09-07 283/week @ 2024-09-14 75/week @ 2024-09-21 143/week @ 2024-09-28 115/week @ 2024-10-05 80/week @ 2024-10-12 206/week @ 2024-10-19 173/week @ 2024-10-26 68/week @ 2024-11-02 74/week @ 2024-11-09

527 downloads per month

MIT license

54KB
1.5K SLoC

tracing-elastic-apm

crates.io version Documentation (latest release)

Elastic APM tracing layer. Uses the native ingest API.

Usage

Create a new tracing Layer:

let layer = tracing_elastic_apm::new_layer(
    "ServiceName".to_string(),
    // remember to use desired protocol below, e.g. http://
    tracing_elastic_apm::Config::new("APM address".to_string())
)?;

Register the layer:

tracing_subscriber::registry()
    .with(layer)
    .init();

Take a look at Config for more configuration options.

Supported feature flags

  • default-tls (enabled by default) - use default TLS backend.
  • rustls-tls - use Rustls TLS backend.

Please see corresponding flags in the reqwest library for more information: https://docs.rs/reqwest/0.11.2/reqwest/#optional-features

Async and time measurements

APM doesn't support the notion of idle time and only tracks actual span durations. Async code naturally interleaves spans at await points, which means span start time + duration might be lower than actual span end time as measured by a wall clock. That in turn means child spans in APM might sometimes start after the parent span start time + duration.

Dependencies

~8–21MB
~300K SLoC