Draft
Conversation
Add client-side trace stats computation that aggregates span metrics
(hits, errors, duration distributions) into 10-second time buckets
and flushes them to the Datadog Agent via POST /v0.6/stats.
This enables the Agent to drop priority-0 (unsampled) traces without
losing service-level metrics.
Key components:
- DDSketch: minimal C++ implementation with 1% relative accuracy, 2048
max bins, and msgpack serialization
- StatsConcentrator: aggregates eligible spans by 12 dimensions
(service, name, resource, type, HTTP/gRPC status codes, span_kind,
synthetics, is_trace_root, peer_tags, HTTP method/endpoint)
- Stats flusher: fire-and-forget POST /v0.6/stats with msgpack payload
- Config: DD_TRACE_STATS_COMPUTATION_ENABLED env var (default: false)
- Headers: Datadog-Client-Computed-Stats, Datadog-Client-Computed-Top-Level
Span eligibility: top-level OR measured OR span.kind in
{server, client, producer, consumer}.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- GRPCStatusCode: serialize as string instead of uint32 to match protobuf definition (string GRPC_status_code = 18) - PeerTags: serialize as msgpack array of "key:value" strings instead of a single comma-separated string (repeated string peer_tags = 16) - Peer tag separator: use ":" instead of "=" to match Go/Java/Python/Ruby - Peer tag keys: update to match Go agent standard (8 keys instead of 17) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
The /v0.6/stats payload was missing TracerVersion, RuntimeID, Sequence, and Service fields required by the spec. Add these four fields to the top-level msgpack map (now 9 keys instead of 5), with Sequence as a monotonically increasing counter that increments on each flush. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix clang-format violations in stats_concentrator.cpp, stats_concentrator.h, and test_stats_concentrator.cpp caught by the verify CI job. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
BenchmarksBenchmark execution time: 2026-03-19 17:11:53 Comparing candidate commit 0bc8472 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 0 unstable metrics. |
…NABLED Regenerate supported-configurations.json to include the new DD_TRACE_STATS_COMPUTATION_ENABLED env var added in environment.h. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
The new source files ddsketch.{cpp,h} and stats_concentrator.{cpp,h}
were missing from the Bazel cc_library srcs list, causing Bazel builds
to fail with 'stats_concentrator.h file not found'.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Client-Side Trace Stats Computation (CSS) from scratch, matching the Go reference implementation.
/v0.6/statsTest plan
Part of cross-tracer CSS v1.3.0 alignment effort.
🤖 Generated with Claude Code