[Backport 7.84.x] Emit a single timeseries for DPA apply mode and controlled resources #56382
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 433 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.363
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #56382"
general
weight: 0.35
AlexanderYastrebov
Backport 84d08f7447c9d53559e40befb7f8ef17eb97e992 from #56316.
___
<!-- dd-meta {"pullId":"00000000-0000-0000-0000-000000000000","source":"chat","resourceId":"6d2bc3b1-5fe3-4ea9-bf22-3c77c34937e4","workflowId":"0cc41a34-4840-4e2b-9bfb-334d5a56a036","codeChangeId":"0cc41a34-4840-4e2b-9bfb-334d5a56a036","sourceType":"chat"} -->
What does this PR do?
Makes the two Cluster Agent workload autoscaling metrics added in #55475 emit one timeseries per DPA (resp. per container constraint) instead of one per dimension/resource:
datadog.cluster_agent.autoscaling.workload.apply_modenow emits a single point carrying onedpa_dimensiontag value per enabled dimension, so a multi-dimensional DPA is tagged with bothdpa_dimension:horizontalanddpa_dimension:vertical. Nothing is emitted when both dimensions are disabled.datadog.cluster_agent.autoscaling.workload.vertical_scaling.controlled_resourcesnow emits a single point per enabled container constraint, carrying oneresource_nametag value per controlled resource (for example bothresource_name:cpuandresource_name:memory).The metric documentation in
pkg/clusteragent/autoscaling/workload/metrics/metrics.mdis updated to describe the resulting cardinality.Motivation
The previous implementation appended one point per enabled dimension and one point per controlled resource, which created several metric contexts for the same DPA. As a result a
countoverapply_modedouble-counted multi-dimensional DPAs, and no single series identified a DPA that autoscales both dimensions; the same applied to a container controlling both CPU and memory.Because Datadog tag keys are multi-valued, keeping a single series preserves filtering (
dpa_dimension:horizontalandresource_name:cpustill match the multi-valued series) while making counts correct. Deduplication of repeated resources, the skip for container constraints withenabled: falseor an emptycontrolledResourceslist, and thekube_container_name:allwildcard mapping are unchanged.Describe how you validated your changes
apply_modepoint carrying both dimension tags (the previous assertion read only the first matching tag and would have passed either way), the preview case asserts the vertical tag is absent, and new cases cover vertical-only and both-dimensions-disabled (no point at all).assertControlledResourcesMetricsnow maps container to all itsresource_namevalues and fails if a container appears in more than one series.TestApplyModeTags,TestControlledResourceTags) checking multi-valued tags, exact tag counts, and that the shared base tags are not mutated, plus an end-to-endTestGeneratePodAutoscalerMetricsSingleTimeseriesPerContexton a multi-dimensional DPA controlling CPU and memory.kubeapiserverbuild tag): red against the pre-fix generator (metric counts 19 vs 17), green with the fix.dda inv testcould not run in this environment (the pinned Go toolchain is not installed and the Bazel download is blocked by the proxy), so the tests were run through the Go toolchain directly with the same build tags.Additional Notes
N/A
---
PR by Bits - View session in Datadog
Comment @datadog to request changes