OpenTelemetry — An observability framework for cloud-native software.

OpenTelemetry Datadog

Community supported vendor integrations for applications instrumented with [OpenTelemetry].

Crates.io: opentelemetry-datadog Documentation LICENSE GitHub Actions CI Gitter chat

Documentation | Chat

Overview

[OpenTelemetry] is a collection of tools, APIs, and SDKs used to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) for analysis in order to understand your software's performance and behavior. This crate provides additional propagators and exporters for sending telemetry data to [Datadog].

Features

opentelemetry-datadog supports following features:

Kitchen Sink Full Configuration

Example showing how to override all configuration options. See the [DatadogPipelineBuilder] docs for details of each option.

```norun use opentelemetry::{KeyValue, trace::Tracer}; use opentelemetry::sdk::{trace::{self, IdGenerator, Sampler}, Resource}; use opentelemetry::sdk::export::trace::ExportResult; use opentelemetrydatadog::{newpipeline, ApiVersion, Error}; use opentelemetryhttp::HttpClient; use asynctrait::asynctrait;

// reqwest and surf are supported through features, if you prefer an // alternate http client you can add support by implementing HttpClient as // shown here. #[derive(Debug)] struct IsahcClient(isahc::HttpClient);

#[asynctrait] impl HttpClient for IsahcClient { async fn send(&self, request: http::Request>) -> ExportResult { let result = self.0.sendasync(request).await.maperr(|err| Error::Other(err.tostring()))?;

 if result.status().is_success() {
   Ok(())
 } else {
   Err(Error::Other(result.status().to_string()).into())
 }

} }

fn main() -> Result<(), opentelemetry::trace::TraceError> { let tracer = newpipeline() .withservicename("myapp") .withversion(ApiVersion::Version05) .withagentendpoint("http://localhost:8126") .withtraceconfig( trace::config() .withsampler(Sampler::AlwaysOn) .withidgenerator(IdGenerator::default()) ) .install_batch(opentelemetry::runtime::Tokio)?;

 tracer.in_span("doing_work", |cx| {
     // Traced app logic here...
 });

 opentelemetry::global::shut_down_provider();

 Ok(())

} ```