← Back to Pull requests

feat(autoscaling): Add an Autoscaling section to the cluster-agent status #58098

Closed
unknown closed this pull request without merging on Oct 14, 2026 11:00 UTC
View on GitHub
unknown unknown commented on Oct 13, 2026 20:12 UTC
Author

What does this PR do?

Adds an Autoscaling section to the Cluster Agent status, and therefore to the flare via cluster-agent-status.log. It reports the number of DatadogPodAutoscaler objects in the store, whether this replica is the leader, and per Remote Configuration product the last update received — its highest config version, when it arrived, how many configurations it carried, a running update count, and the last processing error if any.

===========
Autoscaling
===========

  Workload
  --------
  DatadogPodAutoscalers: 2
  Leader: true

  CONTAINER_AUTOSCALING_SETTINGS
    Last config version: 2
    Last update: 2026-08-28T22:59:53Z (5m56s ago)
    Configs in last update: 1
    Updates received: 1

  CONTAINER_AUTOSCALING_VALUES
    Last config version: 41
    Last update: 2026-08-28T23:05:48Z (1s ago)
    Configs in last update: 1
    Updates received: 7

Motivation

There is no autoscaling section in the Cluster Agent status today, so working out whether workload autoscaling is running — and whether it is actually receiving recommendations — means reading logs.

Describe how you validated your changes

Unit tests for each rendering state (disabled, enabled-but-not-started, started, follower), for the per-product breakdown, and for the reset-on-update behaviour. A wiring test drives a real ConfigRetriever through the existing mock RC client and asserts the update lands under the correct product heading — verified by swapping the two product constants in NewConfigRetriever and confirming it fails. An integration test builds the real status component through fx and asserts the rendered section layout.

Built the cluster-agent; all 18 Bazel test targets under pkg/clusteragent/autoscaling/... and cmd/cluster-agent/subcommands/start/... pass.

Local QA on a kind cluster (fresh single-node kindest/node:v1.37.0, 1-replica
Cluster Agent built from this branch, DatadogPodAutoscaler CRD from the operator):

  • the section renders with the expected shape and indentation, verified through cat -A (no trailing whitespace)

  • DatadogPodAutoscalers: tracked 0 → 1 → 2 → 0 across real DPA create/delete, so it reads the live store rather than a counter

  • Leader: true matched the holder of the datadog-leader-election lock

  • with the feature disabled, and with the setting absent, the section reports "not enabled" and emits no count or leader line

  • the flare's cluster-agent-status.log carries the section identically
  • One branch is not covered by live QA: the populated-product rendering
    (Last config version / Configs failed / Last error). It needs real Remote
    Configuration delivery from an org with RC enabled, which the test environment does
    not have — the agent's own Remote Configuration section read
    Organization enabled: False, so it genuinely received nothing and correctly said
    so rather than inventing an error. That branch is covered by unit tests only.

    Additional Notes

    Extracted from #55619, which bundled this with changes to the Remote Configuration status section and a generic multi-RC-client mechanism. This PR is only the autoscaling status part — nothing under comp/remote-config/ or pkg/config/remote/ is touched.

    The group is named Autoscaling rather than Workload Autoscaling so cluster autoscaling can join it as a sibling sub-section later.

    The per-product blocks are a record of what arrived, not a health verdict. The RC client invokes a product's callback only when that product's config set changes, so No update received yet is the normal state for an organization with no remote DatadogPodAutoscaler, and a cluster in steady state stops receiving updates entirely. The code says so where it builds the section, to stop a future reader treating a growing age as a fault.

    🤖 PR description and code assisted by Claude:claude-opus-5

    Diff: 491 lines (+368 / -123) across 6 files Reviewer: AlexanderYastrebov Review duration: 888m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 491 lines diff across 6 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.371
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #58098"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.4% (MEDIUM) · Higher = larger blast radius
    47.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.7% · Safe to merge
    18.7%