The tracing layer for shipping traces to Axiom.
Add the following to your Cargo.toml
:
toml
[dependencies]
tracing-axiom = "0.2"
Expose an API token with ingest permission under AXIOM_TOKEN
and initialize
and shut down the exporter like this:
```rust
async fn main() { let guard = tracingaxiom::init(); // or tryinit() to handle errors sayhello(); }
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.
Here's a full configuration:
```rust use opentelemetry::sdk::trace;
async fn main() -> Result<(), Box
let guard = tracingaxiom::builder() .withtoken("xaat-123456789") .withurl("https://my-axiom.example.org") .withservicename("my-service") .withtraceconfig(traceconfig) .tryinit()?; Ok(()) } ```
If you want to use other layers next to Axiom in your tracing configuration, check out the fmt example.
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.
The following are a list of Cargo features that can be enabled or disabled:
native-tls
.rustls
.Licensed under either of
at your option.