Crate tracing_axiom
source ·Expand description
Send traces to Axiom with a single line.
§Example
In a project that uses Tokio and
tracing run cargo add tracing-axiom
and
configure it like this:
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
tracing_axiom::init()?; // Set AXIOM_DATASET and AXIOM_TOKEN in your env!
say_hello();
Ok(())
}
#[tracing::instrument]
pub fn say_hello() {
tracing::info!("Hello, world!");
}
The example above gets the Axiom API token from the AXIOM_TOKEN
env and
the dataset name from AXIOM_DATASET
. For more advanced configuration, see builder()
.
Structs§
- Builder for creating a tracing tracer, a layer or a subscriber that sends traces to Axiom via the
OpenTelemetry
protocol. The API token is read from theAXIOM_TOKEN
environment variable. The dataset name is read from theAXIOM_DATASET
environment variable. The URL defaults to Axiom Cloud whose URL ishttps://cloud.axiom.co
but can be overridden by setting theAXIOM_URL
environment variable for testing purposes
Enums§
- The error type for this crate.
Functions§
- Create a new
Builder
. - Initialize a global subscriber which sends traces to Axiom.