feat(stats): add whole key cardinality limit#2158
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a17a2c66d6
ℹ️ 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".
| pub grpc_status_code: Option<u8>, | ||
| pub is_synthetics_request: bool, | ||
| pub is_trace_root: bool, | ||
| pub is_trace_root: pb::Trilean, |
There was a problem hiding this comment.
Bump the SHM version after changing key layout
Changing FixedAggregationKey<StringRef> from a bool to pb::Trilean changes the in-memory size/alignment of ShmKeyHeader, which is embedded in the shared-memory ShmEntry layout. ShmSpanConcentrator::open only rejects incompatible mappings via SHM_VERSION, but that constant remains 1, so during a mixed old/new sidecar or PHP-worker rollout an old process can open a new mapping (or vice versa) and read/write slots using different offsets, corrupting or dropping stats instead of falling back/reopening.
Useful? React with 👍 / 👎.
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
a17a2c6 to
2655975
Compare
|
📚 Documentation Check Results📦
|
Clippy Allow Annotation ReportComparing clippy allow annotations between branches:
Summary by Rule
Annotation Counts by File
Annotation Stats by Crate
About This ReportThis 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. |
🔒 Cargo Deny Results📦
|
bf5e284 to
ce821ea
Compare
ce821ea to
ebd7e4e
Compare
| .is_some_and(|origin| origin.starts_with(TAG_SYNTHETICS)), | ||
| is_trace_root: span.is_trace_root(), | ||
| is_trace_root: if span.is_trace_root() { | ||
| pb::Trilean::True |
There was a problem hiding this comment.
nit (And maybe a dumb idea since I'm not great at rust): Should we have something like Trilean::From(bool)->Trilean to make stuff like this a little nicer to read?

What does this PR do?
Add whole-key cardinality limit to the SpanConcentrator. See this RFC 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
SpanConcentrator
Trilean change
The overflow sentinel key requires us to use a trilean to represent the
is_trace_rootin the aggregation key.