12 stable releases

3.2.3 Aug 12, 2022
3.2.2 Jul 15, 2022
3.2.1 Jun 30, 2022
3.2.0 Oct 27, 2021
1.0.1 Dec 22, 2020

#714 in Web programming

Download history 53/week @ 2023-12-09 85/week @ 2023-12-16 2/week @ 2023-12-23 125/week @ 2023-12-30 43/week @ 2024-01-06 15/week @ 2024-01-13 150/week @ 2024-01-20 102/week @ 2024-01-27 90/week @ 2024-02-03 43/week @ 2024-02-10 91/week @ 2024-02-17 109/week @ 2024-02-24 72/week @ 2024-03-02 160/week @ 2024-03-09 302/week @ 2024-03-16 192/week @ 2024-03-23

759 downloads per month

MIT license

33KB
824 lines

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

~7–23MB
~353K SLoC