Skip to content

feat(stats)!: send telemetry for cardinality limits#2159

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
mainfrom
06-24-feat_stats_send_telemetry_for_cardinality_limits
Jun 30, 2026
Merged

feat(stats)!: send telemetry for cardinality limits#2159
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
mainfrom
06-24-feat_stats_send_telemetry_for_cardinality_limits

Conversation

@VianneyRuhlmann

@VianneyRuhlmann VianneyRuhlmann commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Add telemetry for the collapsed stats group based on this RFC

Motivation

Follow-up of #2158

Additional Notes

Anything else we should know when reviewing?

How to test the change?

Describe here in detail how the change can be validated.

VianneyRuhlmann commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Jun 24, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 97.80%
Overall Coverage: 74.17% (+0.10%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 883025f | Docs | Datadog PR Page | Give us feedback!

@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Clippy Allow Annotation Report

Comparing clippy allow annotations between branches:

  • Base Branch: origin/main
  • PR Branch: origin/06-24-feat_stats_send_telemetry_for_cardinality_limits

Summary by Rule

Rule Base Branch PR Branch Change
unwrap_used 3 3 No change (0%)
Total 3 3 No change (0%)

Annotation Counts by File

File Base Branch PR Branch Change
datadog-sidecar/src/service/stats_flusher.rs 1 1 No change (0%)
libdd-data-pipeline/src/otlp/metrics.rs 1 1 No change (0%)
libdd-trace-stats/src/stats_exporter.rs 1 1 No change (0%)

Annotation Stats by Crate

Crate Base Branch PR Branch Change
clippy-annotation-reporter 5 5 No change (0%)
datadog-ffe-ffi 1 1 No change (0%)
datadog-ipc 22 22 No change (0%)
datadog-live-debugger 4 4 No change (0%)
datadog-live-debugger-ffi 10 10 No change (0%)
datadog-profiling-replayer 4 4 No change (0%)
datadog-sidecar 45 45 No change (0%)
libdd-common 13 13 No change (0%)
libdd-common-ffi 12 12 No change (0%)
libdd-data-pipeline 6 6 No change (0%)
libdd-ddsketch 2 2 No change (0%)
libdd-dogstatsd-client 1 1 No change (0%)
libdd-profiling 13 13 No change (0%)
libdd-remote-config 3 3 No change (0%)
libdd-telemetry 20 20 No change (0%)
libdd-tinybytes 4 4 No change (0%)
libdd-trace-normalization 2 2 No change (0%)
libdd-trace-obfuscation 3 3 No change (0%)
libdd-trace-stats 1 1 No change (0%)
libdd-trace-utils 11 11 No change (0%)
Total 182 182 No change (0%)

About This Report

This report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality.

@VianneyRuhlmann VianneyRuhlmann marked this pull request as ready for review June 24, 2026 17:00
@VianneyRuhlmann VianneyRuhlmann requested review from a team as code owners June 24, 2026 17:00

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f971f0c30c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread libdd-trace-stats/Cargo.toml Outdated
Comment thread libdd-data-pipeline/src/trace_exporter/stats.rs
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_send_telemetry_for_cardinality_limits branch 2 times, most recently from 98f8c1d to fffe30d Compare June 24, 2026 17:41
@VianneyRuhlmann VianneyRuhlmann requested a review from a team as a code owner June 24, 2026 17:41
@VianneyRuhlmann VianneyRuhlmann requested review from mabdinur and removed request for a team June 24, 2026 17:41
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_add_whole-key_cardinality_limit branch 2 times, most recently from 2655975 to bf5e284 Compare June 24, 2026 17:50
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_send_telemetry_for_cardinality_limits branch from fffe30d to e5c0f96 Compare June 24, 2026 17:50
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_add_whole-key_cardinality_limit branch from bf5e284 to ce821ea Compare June 24, 2026 17:59
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_send_telemetry_for_cardinality_limits branch from e5c0f96 to d97928e Compare June 24, 2026 17:59
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_add_whole-key_cardinality_limit branch from ce821ea to ebd7e4e Compare June 24, 2026 18:15
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_send_telemetry_for_cardinality_limits branch from d97928e to c84447e Compare June 24, 2026 18:15
Comment thread libdd-trace-stats/src/stats_exporter.rs Outdated
Comment thread libdd-trace-stats/src/stats_exporter.rs Outdated
@dd-octo-sts

dd-octo-sts Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.82 MB 7.82 MB +0% (+24 B) 👌
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 85.18 MB 85.24 MB +.07% (+62.43 KB) 🔍
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 96.32 MB 96.39 MB +.07% (+71.53 KB) 🔍
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.51 MB 10.52 MB +.05% (+6.25 KB) 🔍
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 25.19 MB 25.21 MB +.07% (+19.00 KB) 🔍
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 88.04 KB 88.04 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 183.52 MB 183.64 MB +.06% (+120.00 KB) 🔍
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 939.74 MB 941.39 MB +.17% (+1.65 MB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.23 MB 8.24 MB +.06% (+5.50 KB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 88.04 KB 88.04 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 24.33 MB 24.36 MB +.09% (+24.00 KB) 🔍
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 48.52 MB 48.57 MB +.10% (+52.43 KB) 🔍
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 21.82 MB 21.83 MB +.06% (+13.50 KB) 🔍
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 89.42 KB 89.42 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 187.54 MB 187.66 MB +.06% (+120.00 KB) 🔍
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 926.89 MB 928.55 MB +.17% (+1.65 MB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.35 MB 6.36 MB +.08% (+5.50 KB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 89.42 KB 89.42 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 26.12 MB 26.14 MB +.08% (+24.00 KB) 🔍
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 46.15 MB 46.20 MB +.11% (+53.00 KB) 🔍
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 75.92 MB 75.97 MB +.06% (+50.32 KB) 🔍
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.70 MB 8.71 MB +.09% (+8.03 KB) 🔍
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 91.39 MB 91.44 MB +.06% (+59.13 KB) 🔍
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.59 MB 10.61 MB +.15% (+16.73 KB) 🔍

Comment thread libdd-trace-stats/Cargo.toml Outdated
Comment thread datadog-sidecar/src/service/stats_flusher.rs
@VianneyRuhlmann VianneyRuhlmann changed the title feat(stats): send telemetry for cardinality limits feat(stats)!: send telemetry for cardinality limits Jun 26, 2026
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_send_telemetry_for_cardinality_limits branch 3 times, most recently from 5294954 to b1f49f4 Compare June 29, 2026 14:20
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_add_whole-key_cardinality_limit branch from ebd7e4e to b04c7f6 Compare June 29, 2026 14:20
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_send_telemetry_for_cardinality_limits branch from b1f49f4 to 88317cd Compare June 29, 2026 15:35
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_add_whole-key_cardinality_limit branch from b04c7f6 to 8d22e4b Compare June 29, 2026 15:35
@VianneyRuhlmann VianneyRuhlmann force-pushed the 06-24-feat_stats_send_telemetry_for_cardinality_limits branch 2 times, most recently from 23624b6 to a9738ee Compare June 30, 2026 11:58
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Jun 30, 2026
# What does this PR do?

Add whole-key cardinality limit to the SpanConcentrator. See [this RFC](https://datadoghq.atlassian.net/wiki/spaces/APM/pages/6821151019/PENDING+Cardinality+Limits) for details

The telemetry metrics specified in the RFC are implemented in #2159

The per fields limit from the RFC is out of the scope of this PR

## Breaking change

The cardinality limit is applied to **all** users of the SpanConcentrator however the limit can be configured manually.

# Motivation

Avoid unbounded bucket growth when dealing with high cardinality.

# Additional Notes

## Limit default value

The limit of 7000 entries has been chosen based on the following results

**Single Bucket**

| Component | Typical | Worst |
| --- | --- | --- |
| HashMap flat table | 3\.5 MB _(unchanged)_ | 3\.5 MB _(unchanged)_ |
| String heap (7 001 × 76 / 122 B) | 0\.5 MB | 0\.9 MB |
| DDSketch bins (7 001 × 1 600 / 32 768 B) | 11\.2 MB | 229\.3 MB |
| **StatsBucket total** | **~15.2 MB** | **~233.7 MB** |

**SpanConcentrator**

| Limit | Typical (3 buckets) | Worst (3 buckets) |
| --- | --- | --- |
| **7 000** | **~45.6 MB** | **~701.2 MB** |

## Trilean change

The overflow sentinel key requires us to use a trilean to represent the `is_trace_root` in the aggregation key.

Co-authored-by: vianney.ruhlmann <vianney.ruhlmann@datadoghq.com>
Base automatically changed from 06-24-feat_stats_add_whole-key_cardinality_limit to main June 30, 2026 14:12
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot requested a review from a team as a code owner June 30, 2026 14:12
@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Jun 30, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-06-30 14:13:03 UTC ℹ️ Start processing command devflow:merge


2026-06-30 14:13:10 UTC ℹ️ MergeQueue: waiting for PR to be ready

This pull request is not mergeable according to GitHub. Common reasons include pending required checks, missing approvals, or merge conflicts — but it could also be blocked by other repository rules or settings.
It will be added to the queue as soon as checks pass and/or get approvals. View in MergeQueue UI.
Note: if you pushed new commits since the last approval, you may need additional approval.
You can remove it from the waiting list with /remove command.


2026-06-30 16:00:10 UTC ℹ️ MergeQueue: merge request added to the queue

The expected merge time in main is approximately 1h (p90).


2026-06-30 16:58:50 UTC ℹ️ MergeQueue: Readding this merge request to the queue because another merge request processed with yours failed. No action is needed from your side.


2026-06-30 18:04:28 UTC ℹ️ MergeQueue: This merge request was merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants