tracing-axiom

CI crates.io docs.rs License

The tracing layer for shipping traces to Axiom.

Install

Add the following to your Cargo.toml:

toml [dependencies] tracing-axiom = "0.1"

Quickstart

Expose an API token with ingest permission under AXIOM_TOKEN and initialize and shut down the exporter like this:

```rust

[tokio::main]

async fn main() { tracingaxiom::init(); // or tryinit() to handle errors sayhello(); tracingaxiom::shutdown(); }

[tracing::instrument]

pub fn say_hello() { tracing::info!("Hello, world!"); } ```

Note: Due to a limitation of an underlying library, events outside of a span are not recorded.

Kitchen Sink Full Configuration

Here's a full configuration:

```rust use opentelemetry::sdk::trace;

[tokio::main]

async fn main() -> Result<(), Box> { let traceconfig = trace::Config::default() .withmaxeventsper_span(42);

tracingaxiom::builder() .withtoken("xaat-123456789") .withurl("https://my-axiom.example.org") .withservicename("my-service") .withtraceconfig(traceconfig) .try_init()?; Ok(()) } ```

If you want to use other layers next to Axiom in your tracing configuration, check out the fmt example.

Under The Hood

This library uses OpenTelemetry to send data to Axiom. You can set this up yourself if you want to, but make sure to use the OTLP format with the http transport and set the endpoint to https://cloud.axiom.co/api/v1/traces. A good entrypoint is the opentelemetry-otlp crate.

Features

The following are a list of Cargo features that can be enabled or disabled:

License

Licensed under either of

at your option.