Skip to content

Wire per-component cardinality limits from Config#11732

Open
dougqh wants to merge 2 commits into
dougqh/control-tag-cardinalityfrom
dougqh/cardinality-limits-config
Open

Wire per-component cardinality limits from Config#11732
dougqh wants to merge 2 commits into
dougqh/control-tag-cardinalityfrom
dougqh/cardinality-limits-config

Conversation

@dougqh

@dougqh dougqh commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Adds the ability to configure cardinality limits per component / tag for client-side stats

Motivation

Avoid problems with high cardinality leading to excessive resource consumption while informing the customer (via sentinel value) when a limit was reached

Additional Notes

Unlike #11387 which introduced the limiting mechanism, this PR enables the limits by default.

  • Adds a single parameterized Config.getTraceStatsCardinalityLimit(tagName, defaultLimit) method following the RFC naming pattern DD_TRACE_STATS_{tag_name}_CARDINALITY_LIMIT
  • Wires all 9 per-field PropertyCardinalityHandler instances and the TagCardinalityHandler in PeerTagSchema to read their limits from Config at class-load time, with defaults from MetricCardinalityLimits
  • Activates sentinel substitution (useBlockedSentinel = true) now that limits are configurable; previously hardcoded to false pending this wiring
  • Registers all 10 config keys in supported-configurations.json

Stacked on #11387.

Test plan

  • Existing CardinalityHandlerTest and AggregateEntryTest cover sentinel substitution behavior
  • Verify default limits match MetricCardinalityLimits constants
  • Confirm DD_TRACE_STATS_RESOURCE_CARDINALITY_LIMIT etc. are picked up at startup via Config

tag: no release note
tag: ai generated

🤖 Generated with Claude Code

…its RFC

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dougqh dougqh requested review from a team as code owners June 24, 2026 17:03
@dougqh dougqh requested review from AlexeyKuznetsov-DD and ygree and removed request for a team June 24, 2026 17:03
@dd-octo-sts dd-octo-sts Bot added the tag: ai generated Largely based on code generated by an AI or LLM label Jun 24, 2026

@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: 75f72165fd

ℹ️ 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 on lines +3853 to +3854
return configProvider.getInteger(
"trace.stats." + tagName + ".cardinality.limit", defaultLimit);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Validate stats cardinality limits before returning them

When any of the new DD_TRACE_STATS_*_CARDINALITY_LIMIT values is set to 0, a negative number, or a value above 2^29, this method returns it unchanged; the callers added in AggregateEntry and PeerTagSchema pass it directly into PropertyCardinalityHandler/TagCardinalityHandler, whose constructors throw for those ranges. In that misconfigured environment the stats classes fail initialization instead of falling back to the default/logging, so the accessor should reject invalid limits before handing them to the handlers.

Useful? React with 👍 / 👎.

"DD_TRACE_STATS_RESOURCE_CARDINALITY_LIMIT": [
{
"version": "A",
"type": "integer",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use int for the new config metadata type

The supported-configurations metadata uses type: "int" for the existing integral settings (including the tracer metrics limits), while these ten new cardinality entries are the only ones using "integer". The local supported-configurations validation/publishing jobs consume this file, so the new configs can be rejected or omitted by downstream metadata consumers even though the agent code reads integers; please use int consistently for these entries.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yup, int is used instead of integer in the file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dd-octo-sts

dd-octo-sts Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 13.92 s 13.92 s [-0.7%; +0.7%] (no difference)
startup:insecure-bank:tracing:Agent 12.97 s 12.98 s [-1.0%; +0.8%] (no difference)
startup:petclinic:appsec:Agent 16.90 s 16.79 s [-0.3%; +1.6%] (no difference)
startup:petclinic:iast:Agent 16.87 s 16.90 s [-1.1%; +0.8%] (no difference)
startup:petclinic:profiling:Agent 16.53 s 16.74 s [-2.1%; -0.4%] (maybe better)
startup:petclinic:sca:Agent 16.82 s 16.80 s [-0.8%; +1.1%] (no difference)
startup:petclinic:tracing:Agent 15.98 s 15.62 s [-2.0%; +6.6%] (no difference)

Commit: 44e64a02 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

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

Labels

tag: ai generated Largely based on code generated by an AI or LLM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants