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

use dd_tracing_layer::DatadogOptions;
use tracing_subscriber::prelude::*;
use tracing::{instrument, subscriber};

#[instrument]
fn log(msg: &'static str) {
  tracing::info!("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

Enums

Functions

  • Creates a log layer that will send logs to Datadog