Crates.io | tracing-axiom |
lib.rs | tracing-axiom |
version | 0.7.0 |
source | src |
created_at | 2022-08-26 12:41:03.551734 |
updated_at | 2024-05-23 13:51:32.910755 |
description | The tracing layer for shipping traces to Axiom |
homepage | https://axiom.co |
repository | https://github.com/axiomhq/tracing-axiom |
max_upload_size | |
id | 652796 |
size | 91,121 |
Axiom unlocks observability at any scale.
For more information check out the official documentation.
Add the following to your Cargo.toml
:
[dependencies]
tracing-axiom = "0.7"
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 like this:
use tracing_subscriber::{layer::SubscriberExt as _, util::SubscriberInitExt as _, Registry};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let axiom_layer = tracing_axiom::default("readme")?; // Set AXIOM_DATASET and AXIOM_TOKEN in your env!
Registry::default().with(axiom_layer).init();
say_hello();
Ok(())
}
#[tracing::instrument]
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:
rustls
.native-tls
.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.
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.