Crate dd_tracing_layer

source ·
Expand description

A tracing layer that sends logs to Datadog.

It’s mainly useful when you don’t have access to your infrastructure and you cannot use the Datadog Agent or any other mean.

Example

#[instrument]
fn log(msg: &'static str) {
 tracing::info!(format!("your message: {}", msg));
}

fn main() {
   let options = DatadogOptions::new("my-service", "my-datadog-api-key")
       .with_tags("env:dev");
   let dd = dd_tracing_layer::create(options);
   let subscriber = tracing_subscriber::registry()
       .with(tracing_subscriber::fmt::Layer::new().json())
       .with(dd);
   let _s = subscriber::set_default(subscriber);
   log("hello world!");
}

Structs

Functions

Creates a log layer that will send logs to Datadog