| Crates.io | libdd-trace-stats |
| lib.rs | libdd-trace-stats |
| version | 1.0.0 |
| created_at | 2025-11-18 11:35:20.378914+00 |
| updated_at | 2025-11-18 11:35:20.378914+00 |
| description | This crate provides utilities to compute stats from Datadog traces. |
| homepage | https://github.com/DataDog/libdatadog/tree/main/libdd-trace-stats |
| repository | https://github.com/DataDog/libdatadog/tree/main/libdd-trace-stats |
| max_upload_size | |
| id | 1938298 |
| size | 119,198 |
Compute aggregated statistics from distributed tracing spans with time-bucketed concentration.
libdd-trace-stats provides utilities for computing trace statistics by aggregating spans into time-based buckets with support for DDSketch distributions.
The SpanConcentrator is the core component that aggregates spans into statistics:
Spans are aggregated into time buckets based on their end time. Within each bucket, spans are further aggregated by:
Only certain spans are aggregated:
span.kind valuesWhen flushed, the concentrator keeps the most recent buckets and returns older buckets as statistics.
use libdd_trace_stats::span_concentrator::SpanConcentrator;
use std::time::{Duration, SystemTime};
// Create a concentrator
let mut concentrator = SpanConcentrator::new(
Duration::from_secs(10), // 10 second buckets
SystemTime::now(),
vec!["client".to_string(), "server".to_string()], // eligible span kinds
vec!["peer.service".to_string()], // peer tag keys
);
// Add spans
// concentrator.add_span(&span);
// Flush statistics
// let stats = concentrator.flush(false);