Skip to content

NDM Agent Workload Balancing: gate check execution on group membership - #55064

Draft
matthewleese wants to merge 2 commits into
mleese/ndm-workload-balancing-componentfrom
mleese/ndm-workload-balancing-check-gating
Draft

NDM Agent Workload Balancing: gate check execution on group membership#55064
matthewleese wants to merge 2 commits into
mleese/ndm-workload-balancing-componentfrom
mleese/ndm-workload-balancing-check-gating

Conversation

@matthewleese

Copy link
Copy Markdown
Contributor

Note: This PR was created by Claude.

Third PR in the NDM Agent Workload Balancing sequence (after #54853 and #54993). Stacked on the comp/workloadbalancing component skeleton from #54993.

What this does

  • Adds WorkloadBalancingGroupID() string to the Check interface and implements it across every implementer: CheckBase (default ""), StubCheck, stats.StatsCheck, PythonCheck, the sharedlibrary Check, APMCheck, ProcessAgentCheck, and middleware.CheckWrapper.
  • Adds SNMP's new instance-level agent_workload_balancing_group field, including the Copy() fix so devices derived via CopyWithNewIP in subnet-discovery mode retain their group assignment instead of silently losing it.
  • Adds the gating branch in pkg/collector/worker/worker.go: a check with a non-empty workload balancing group runs only if workloadBalancing.IsGroupActive(group); a check with no group keeps the existing HA-leader gating behavior unchanged.
  • Threads a workloadbalancing.Component dependency through collector.go -> runner.go -> worker.go, mirroring the existing haAgent wiring.

Testing

  • TestWorker_WorkloadBalancingGating in worker_test.go: group active runs, group inactive skips, no group is unaffected by workload balancing gating.
  • SNMP config tests cover agent_workload_balancing_group YAML parsing, Copy(), and a discovery-mode case asserting CopyWithNewIP retains the group.
  • Verified clean go build/go vet/go test under default, -tags test, and -tags python for every touched package. The -tags python pass matters here since PythonCheck implements Check independently and a missed method there is exactly what caused a P1 build break on an earlier related PR (feat(ndm): emit a metric per workload balancing group #54656).

Deviation from the implementation plan

The plan called for documenting agent_workload_balancing_group in pkg/config/schema/yaml/core_schema.yaml, "alongside wherever SNMP's other instance-level keys are documented." I checked and that file only covers datadog.yaml-level agent config; none of SNMP's existing instance-level keys (community_string, ip_address, etc.) appear there. There's no per-integration-instance schema doc location in this repo to add this field to, so I did not add an entry.

Add Check.WorkloadBalancingGroupID() to the check interface and thread a
workloadbalancing.Component dependency through collector -> runner ->
worker so a check assigned to a workload balancing group only runs when
that group is active on the local agent. Checks with no group keep the
existing HA-leader gating behavior unchanged.

Add the SNMP instance-level agent_workload_balancing_group field,
including the Copy() fix so subnet-discovery devices derived via
CopyWithNewIP retain their group assignment instead of silently losing
it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@dd-octo-sts

dd-octo-sts Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Go Package Import Differences

Baseline: 7c903c9
Comparison: 4a70f16

binaryosarchchange
agentlinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
agentlinuxarm64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
agentwindowsamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
agentdarwinamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
agentdarwinarm64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
agentaixppc64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
iot-agentlinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
iot-agentlinuxarm64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
heroku-agentlinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
cluster-agentlinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
cluster-agentlinuxarm64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
cluster-agent-cloudfoundrylinuxamd64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl
cluster-agent-cloudfoundrylinuxarm64
+4, -0
+github.com/DataDog/datadog-agent/comp/workloadbalancing/def
+github.com/DataDog/datadog-agent/comp/workloadbalancing/fx
+github.com/DataDog/datadog-agent/comp/workloadbalancing/helpers
+github.com/DataDog/datadog-agent/comp/workloadbalancing/impl

@datadog-official

datadog-official Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 65.00%
Overall Coverage: 52.44% (-0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4a70f16 | Docs | View more details | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Files inventory check summary

File checks results against ancestor 7c903c92:

Results for datadog-agent_7.84.0~devel.git.245.4a70f16.pipeline.131706469-1_amd64.deb:

No change detected

Results for datadog-iot-agent_7.84.0~devel.git.245.4a70f16.pipeline.131706469-1_amd64.deb:

No change detected

@cit-pr-commenter-54b7da

cit-pr-commenter-54b7da Bot commented Aug 18, 2026

Copy link
Copy Markdown

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Job ID: f32af8b8-d2b2-42a3-b29b-c7135651b015

Baseline: 7c903c9
Comparison: 4a70f16
Diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
quality_gate_metrics_logs memory utilization +0.72 [+0.47, +0.97] 1 Logs bounds checks dashboard
quality_gate_idle_all_features memory utilization +0.45 [+0.41, +0.49] 1 Logs bounds checks dashboard
quality_gate_security_idle memory utilization +0.25 [+0.14, +0.35] 1 Logs bounds checks dashboard
quality_gate_security_no_fs_load memory utilization +0.21 [+0.06, +0.35] 1 Logs bounds checks dashboard
quality_gate_security_mean_fs_load memory utilization +0.09 [+0.02, +0.17] 1 Logs bounds checks dashboard
quality_gate_idle memory utilization -0.37 [-0.49, -0.26] 1 Logs bounds checks dashboard
quality_gate_private_action_runner memory utilization -0.42 [-0.54, -0.30] 1 Logs bounds checks dashboard
quality_gate_logs % cpu utilization -1.12 [-2.01, -0.23] 1 Logs bounds checks dashboard

Bounds Checks: ✅ Passed

perf experiment bounds_check_name replicates_passed observed_value links
quality_gate_idle intake_connections 10/10 4 = 4 bounds checks dashboard
quality_gate_idle memory_usage 10/10 173.27MiB ≤ 178MiB bounds checks dashboard
quality_gate_idle total_bytes_received 10/10 741.47KiB ≤ 819.20KiB bounds checks dashboard
quality_gate_idle_all_features intake_connections 10/10 4 = 4 bounds checks dashboard
quality_gate_idle_all_features memory_usage 10/10 512.29MiB ≤ 538MiB bounds checks dashboard
quality_gate_idle_all_features total_bytes_received 10/10 1.13MiB ≤ 1.25MiB bounds checks dashboard
quality_gate_logs intake_connections 10/10 16 ≤ 40 bounds checks dashboard
quality_gate_logs memory_usage 10/10 203.39MiB ≤ 229MiB bounds checks dashboard
quality_gate_logs missed_bytes 10/10 0B = 0B bounds checks dashboard
quality_gate_logs total_bytes_received 10/10 264.15MiB ≤ 292MiB bounds checks dashboard
quality_gate_metrics_logs cpu_usage 10/10 363.05 ≤ 2000 bounds checks dashboard
quality_gate_metrics_logs intake_connections 10/10 16 ≤ 40 bounds checks dashboard
quality_gate_metrics_logs memory_usage 10/10 394.08MiB ≤ 439MiB bounds checks dashboard
quality_gate_metrics_logs missed_bytes 10/10 0B = 0B bounds checks dashboard
quality_gate_metrics_logs total_bytes_received 10/10 0.94GiB ≤ 1.04GiB bounds checks dashboard
quality_gate_private_action_runner memory_usage 10/10 71.94MiB ≤ 76MiB bounds checks dashboard
quality_gate_security_idle cpu_usage 10/10 27.37 ≤ 100 bounds checks dashboard
quality_gate_security_idle memory_usage 10/10 329.37MiB ≤ 335MiB bounds checks dashboard
quality_gate_security_mean_fs_load cpu_usage 10/10 61.22 ≤ 200 bounds checks dashboard
quality_gate_security_mean_fs_load memory_usage 10/10 302.78MiB ≤ 314MiB bounds checks dashboard
quality_gate_security_no_fs_load cpu_usage 10/10 24.30 ≤ 100 bounds checks dashboard
quality_gate_security_no_fs_load memory_usage 10/10 309.78MiB ≤ 343MiB bounds checks dashboard

Explanation

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

CI Pass/Fail Decision

Passed. All Quality Gates passed.

  • quality_gate_metrics_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_security_mean_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_mean_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_security_idle, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_private_action_runner, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_no_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_security_no_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.

@dd-octo-sts

dd-octo-sts Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor 7c903c9
📊 Static Quality Gates Dashboard
🔗 SQG Job

Successful checks

Info

Quality gate Change Size (prev → curr → max)
agent_deb_amd64 +32.56 KiB (0.00% increase, -0.79% of buffer) 760.468 → 760.500 → 764.500
agent_deb_amd64_fips +32.56 KiB (0.00% increase, -1.32% of buffer) 713.329 → 713.361 → 715.740
agent_heroku_amd64 +24.56 KiB (0.01% increase, -0.37% of buffer) 312.561 → 312.585 → 319.050
agent_msi +36.08 KiB (0.01% increase, -0.21% of buffer) 644.212 → 644.247 → 660.960
agent_rpm_amd64 +32.56 KiB (0.00% increase, -0.79% of buffer) 760.452 → 760.483 → 764.470
agent_rpm_amd64_fips +32.56 KiB (0.00% increase, -1.31% of buffer) 713.313 → 713.344 → 715.740
agent_rpm_arm64 +28.56 KiB (0.00% increase, -8.58% of buffer) 736.215 → 736.243 → 736.540
agent_rpm_arm64_fips +36.56 KiB (0.01% increase, -2.76% of buffer) 692.398 → 692.434 → 693.690
agent_suse_amd64 +32.56 KiB (0.00% increase, -0.79% of buffer) 760.452 → 760.483 → 764.470
agent_suse_amd64_fips +32.56 KiB (0.00% increase, -1.31% of buffer) 713.313 → 713.344 → 715.740
agent_suse_arm64 +28.56 KiB (0.00% increase, -8.58% of buffer) 736.215 → 736.243 → 736.540
agent_suse_arm64_fips +36.56 KiB (0.01% increase, -2.76% of buffer) 692.398 → 692.434 → 693.690
docker_agent_amd64 +32.56 KiB (0.00% increase, -3.33% of buffer) 819.084 → 819.116 → 820.040
docker_agent_arm64 +28.57 KiB (0.00% increase, -3.29% of buffer) 819.891 → 819.919 → 820.740
docker_agent_jmx_amd64 +32.56 KiB (0.00% increase, -3.88% of buffer) 1009.981 → 1010.013 → 1010.800
docker_agent_jmx_arm64 +28.56 KiB (0.00% increase, -2.85% of buffer) 999.441 → 999.469 → 1000.420
docker_cluster_agent_amd64 +20.02 KiB (0.01% increase, -2.37% of buffer) 210.475 → 210.494 → 211.300
docker_cluster_agent_arm64 +64.03 KiB (0.03% increase, -17.64% of buffer) 223.456 → 223.518 → 223.810
docker_dogstatsd_arm64 -64.0 KiB (0.17% reduction, +9.65% of buffer) 37.622 → 37.560 → 38.270
docker_host_profiler_amd64 +5.42 KiB (0.00% increase, -0.04% of buffer) 305.814 → 305.819 → 317.690
iot_agent_deb_amd64 +24.03 KiB (0.05% increase, -2.23% of buffer) 46.479 → 46.503 → 47.530
iot_agent_deb_arm64 +24.03 KiB (0.05% increase, -2.20% of buffer) 43.131 → 43.155 → 44.200
iot_agent_deb_armhf +20.02 KiB (0.04% increase, -1.82% of buffer) 43.914 → 43.934 → 44.990
iot_agent_rpm_amd64 +24.03 KiB (0.05% increase, -2.23% of buffer) 46.480 → 46.503 → 47.530
iot_agent_suse_amd64 +24.03 KiB (0.05% increase, -2.23% of buffer) 46.478 → 46.502 → 47.530
8 successful checks with minimal change (< 2 KiB)
Quality gate Current Size
docker_cws_instrumentation_amd64 7.439 MiB
docker_cws_instrumentation_arm64 6.877 MiB
docker_dogstatsd_amd64 39.482 MiB
docker_host_profiler_arm64 317.126 MiB
dogstatsd_deb_amd64 30.224 MiB
dogstatsd_deb_arm64 28.247 MiB
dogstatsd_rpm_amd64 30.224 MiB
dogstatsd_suse_amd64 30.224 MiB

bazel:run-gazelle and every lint_* CI job failed because the new
comp/workloadbalancing dep wasn't reflected in BUILD.bazel for the
collector, runner, and worker packages. Ran bazel run //:gazelle to
regenerate.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant