This is still experimental. Traces are ingested raw into Axiom and there's no nice way to view them (yet).
Axiom unlocks observability at any scale.
For more information check out the official documentation.
Add the following to your Cargo.toml:
toml
[dependencies]
tracing-axiom = "0.4"
Create a dataset in Axiom and export the name as AXIOM_DATASET
.
Then create an API token with ingest permission into that dataset in
the Axiom settings and export it as
AXIOM_TOKEN
.
Now you can set up tracing in one line like this:
```rust
async fn main() { let guard = tracingaxiom::init(); // or tryinit() if you want to handle errors sayhello(); }
pub fn say_hello() { tracing::info!("Hello, world!"); } ```
For further examples, head over to the examples directory.
Note: Due to a limitation of an underlying library, events outside of a span are not recorded.
The following are a list of Cargo features that can be enabled or disabled:
native-tls
.rustls
.You can use this library to get a tracing-subscriber::layer
and combine it with other layers, for example one that prints traces to the
console.
You can see how this works in the fmt example.
init
, try_init
and layer
all return a Guard
, which will shutdown the
tracer provider on drop.
Logs won't be sent to Axiom if the Guard
is dropped prematurely.
If you have a function that sets up observability, return the Guard
up to the
main func to prevent it from being dropped.
This can happen when you use #[tokio::test]
as that defaults to a
single-threaded executor, but the
opentelemetry
crate requires a multi-thread
executor.
Licensed under either of
at your option.