[FR] - Trigger payloads through AGENT_TASK #57598
[P2] Make timeout coverage independent of scheduling speed
The 50 ms deadline starts before Trigger and its health sender run, but the test requires the health send to succeed before expiration. On a busy CI worker, the context can expire before that goroutine publishes its result, causing Trigger to return a total failure and require.ErrorAs to fail. Synchronize with completion of the health send before canceling the context, or inject a mock clock and advance it deterministically.
AI review by Codex (OpenAI) - workflow run
The patch is incorrect: the new timeout test depends on goroutine scheduling within 50 ms and can fail intermittently under CI load.
Go Package Import Differences
Baseline: 739aeea22b6e17e1c2d56981952ee254a1bd962b
Comparison: bb73d4b11748aa73db490533089fd147791c31b8
<table><thead><tr><th>binary</th><th>os</th><th>arch</th><th>change</th></tr></thead><tbody>
<tr><td>agent</td><td>linux</td><td>amd64</td><td><details><summary>+3, -0</summary>
<pre lang='diff'>
+github.com/DataDog/datadog-agent/comp/triggerpayloads/def
+github.com/DataDog/datadog-agent/comp/triggerpayloads/fx
+github.com/DataDog/datadog-agent/comp/triggerpayloads/impl
</pre></details></td></tr>
<tr><td>agent</td><td>linux</td><td>arm64</td><td><details><summary>+3, -0</summary>
<pre lang='diff'>
+github.com/DataDog/datadog-agent/comp/triggerpayloads/def
+github.com/DataDog/datadog-agent/comp/triggerpayloads/fx
+github.com/DataDog/datadog-agent/comp/triggerpayloads/impl
</pre></details></td></tr>
<tr><td>agent</td><td>windows</td><td>amd64</td><td><details><summary>+3, -0</summary>
<pre lang='diff'>
+github.com/DataDog/datadog-agent/comp/triggerpayloads/def
+github.com/DataDog/datadog-agent/comp/triggerpayloads/fx
+github.com/DataDog/datadog-agent/comp/triggerpayloads/impl
</pre></details></td></tr>
<tr><td>agent</td><td>darwin</td><td>amd64</td><td><details><summary>+3, -0</summary>
<pre lang='diff'>
+github.com/DataDog/datadog-agent/comp/triggerpayloads/def
+github.com/DataDog/datadog-agent/comp/triggerpayloads/fx
+github.com/DataDog/datadog-agent/comp/triggerpayloads/impl
</pre></details></td></tr>
<tr><td>agent</td><td>darwin</td><td>arm64</td><td><details><summary>+3, -0</summary>
<pre lang='diff'>
+github.com/DataDog/datadog-agent/comp/triggerpayloads/def
+github.com/DataDog/datadog-agent/comp/triggerpayloads/fx
+github.com/DataDog/datadog-agent/comp/triggerpayloads/impl
</pre></details></td></tr>
<tr><td>agent</td><td>aix</td><td>ppc64</td><td><details><summary>+3, -0</summary>
<pre lang='diff'>
+github.com/DataDog/datadog-agent/comp/triggerpayloads/def
+github.com/DataDog/datadog-agent/comp/triggerpayloads/fx
+github.com/DataDog/datadog-agent/comp/triggerpayloads/impl
</pre></details></td></tr>
<tr><td>iot-agent</td><td>linux</td><td>amd64</td><td><details><summary>+3, -0</summary>
<pre lang='diff'>
+github.com/DataDog/datadog-agent/comp/triggerpayloads/def
+github.com/DataDog/datadog-agent/comp/triggerpayloads/fx
+github.com/DataDog/datadog-agent/comp/triggerpayloads/impl
</pre></details></td></tr>
<tr><td>iot-agent</td><td>linux</td><td>arm64</td><td><details><summary>+3, -0</summary>
<pre lang='diff'>
+github.com/DataDog/datadog-agent/comp/triggerpayloads/def
+github.com/DataDog/datadog-agent/comp/triggerpayloads/fx
+github.com/DataDog/datadog-agent/comp/triggerpayloads/impl
</pre></details></td></tr>
<tr><td>heroku-agent</td><td>linux</td><td>amd64</td><td><details><summary>+3, -0</summary>
<pre lang='diff'>
+github.com/DataDog/datadog-agent/comp/triggerpayloads/def
+github.com/DataDog/datadog-agent/comp/triggerpayloads/fx
+github.com/DataDog/datadog-agent/comp/triggerpayloads/impl
</pre></details></td></tr>
</tbody></table>
🎯 Code Coverage (<a target='_blank' href='https://app.datadoghq.com/ci/code-coverage/github.com%2Fdatadog%2Fdatadog-agent/pull-requests/57598'>details</a>)<br>• <strong><span title="Percentage of modified executable lines covered by tests in this PR">Patch Coverage</span></strong>: 89.21%<br>• <strong><span title="Percentage of all executable lines covered by tests in the entire codebase">Overall Coverage</span></strong>: 62.56% <span title="Change in overall coverage compared to the base branch">(+3.39%)</span><br>
<sub>
This comment will be updated automatically if new data arrives. <br />
🔗 Commit SHA: bb73d4b | <a href="https://docs.datadoghq.com/integrations/guide/source-code-integration/#pr-comments">Docs</a> | Give us <a href="https://dd.enterprise.slack.com/archives/C07E3U2QRMM">feedback</a>!
</sub>
Static quality checks
✅ Please find below the results from static quality gates
Comparison made with ancestor 739aeea22b6e17e1c2d56981952ee254a1bd962b
📊 Static Quality Gates Dashboard
🔗 SQG Job
<details open>
<summary>Successful checks</summary>
Info
||Quality gate|Change|Size (prev → curr → max)|
|--|--|--|--|
|✅|agent_deb_amd64|+20.0 KiB (0.00% increase, -0.17% of buffer)|749.256 → 749.276 → 760.600|
|✅|agent_deb_amd64_fips|+28.0 KiB (0.00% increase, -0.23% of buffer)|681.899 → 681.927 → 693.640|
|✅|agent_heroku_amd64|+24.0 KiB (0.01% increase, -0.27% of buffer)|311.595 → 311.619 → 320.190|
|✅|agent_msi|+26.0 KiB (0.00% increase, -0.61% of buffer)|651.055 → 651.080 → 655.230|
|✅|agent_rpm_amd64|+20.0 KiB (0.00% increase, -0.17% of buffer)|749.240 → 749.260 → 760.580|
|✅|agent_rpm_amd64_fips|+28.0 KiB (0.00% increase, -0.23% of buffer)|681.883 → 681.911 → 693.620|
|✅|agent_rpm_arm64|+24.0 KiB (0.00% increase, -0.20% of buffer)|719.645 → 719.668 → 731.150|
|✅|agent_rpm_arm64_fips|+24.0 KiB (0.00% increase, -0.20% of buffer)|657.891 → 657.915 → 669.800|
|✅|agent_suse_amd64|+20.0 KiB (0.00% increase, -0.17% of buffer)|749.240 → 749.260 → 760.580|
|✅|agent_suse_amd64_fips|+28.0 KiB (0.00% increase, -0.23% of buffer)|681.883 → 681.911 → 693.620|
|✅|agent_suse_arm64|+24.0 KiB (0.00% increase, -0.20% of buffer)|719.645 → 719.668 → 731.150|
|✅|agent_suse_arm64_fips|+24.0 KiB (0.00% increase, -0.20% of buffer)|657.891 → 657.915 → 669.800|
|✅|docker_agent_amd64|+20.0 KiB (0.00% increase, -0.17% of buffer)|805.327 → 805.347 → 816.790|
|✅|docker_agent_arm64|+24.0 KiB (0.00% increase, -0.20% of buffer)|800.386 → 800.409 → 812.020|
|✅|docker_agent_jmx_amd64|+19.99 KiB (0.00% increase, -0.17% of buffer)|996.197 → 996.217 → 1007.660|
|✅|docker_agent_jmx_arm64|+24.0 KiB (0.00% increase, -0.20% of buffer)|980.036 → 980.059 → 991.670|
|✅|iot_agent_deb_amd64|+24.0 KiB (0.05% increase, -2.99% of buffer)|47.625 → 47.648 → 48.410|
|✅|iot_agent_deb_arm64|+24.0 KiB (0.05% increase, -2.92% of buffer)|44.068 → 44.092 → 44.870|
|✅|iot_agent_deb_armhf|+24.0 KiB (0.05% increase, -2.93% of buffer)|44.881 → 44.905 → 45.680|
|✅|iot_agent_rpm_amd64|+24.0 KiB (0.05% increase, -2.95% of buffer)|47.625 → 47.649 → 48.420|
|✅|iot_agent_suse_amd64|+24.0 KiB (0.05% increase, -2.98% of buffer)|47.624 → 47.648 → 48.410|
</details>
<details>
<summary>12 successful checks with minimal change (< 2 KiB)</summary>
||Quality gate|Current Size|
|--|--|--|
|✅|docker_cws_instrumentation_amd64|7.447 MiB|
|✅|docker_cws_instrumentation_arm64|6.877 MiB|
|✅|docker_dogstatsd_amd64|40.121 MiB|
|✅|docker_dogstatsd_arm64|38.136 MiB|
|✅|docker_host_profiler_amd64|309.031 MiB|
|✅|docker_host_profiler_arm64|320.145 MiB|
|✅|dogstatsd_deb_amd64|30.864 MiB|
|✅|dogstatsd_deb_arm64|28.806 MiB|
|✅|dogstatsd_rpm_amd64|30.864 MiB|
|✅|dogstatsd_suse_amd64|30.864 MiB|
|✅|docker_cluster_agent_amd64|211.844 MiB|
|✅|docker_cluster_agent_arm64|224.797 MiB|
</details>
Regression Detector
Regression Detector Results
Metrics dashboard
Target profiles
Job ID: d6596275-bf98-4f65-b95b-1e891fe7e20b
Baseline: 739aeea22b6e17e1c2d56981952ee254a1bd962b
Comparison: bb73d4b11748aa73db490533089fd147791c31b8
[Diff](739aeea22b6e17e1c2d56981952ee254a1bd962b...bb73d4b11748aa73db490533089fd147791c31b8)
Optimization Goals: ✅ No significant changes detected
<details>
<summary><h2>
Fine details of change detection per experiment
</h2></summary>
| perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
|------|---------------------------------------------|--------------------|----------|----------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ➖ | dsd_uds_10mb_3k_timestamped_contexts_cpu | % cpu utilization | +1.05 | [+0.78, +1.33] | 1 | Logs |
| ➖ | dsd_uds_10mb_3k_timestamped_contexts_memory | memory utilization | +0.69 | [+0.48, +0.91] | 1 | Logs |
| ➖ | quality_gate_security_mean_fs_load | memory utilization | +0.69 | [+0.64, +0.75] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_metrics_logs | memory utilization | +0.64 | [+0.41, +0.88] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_private_action_runner | memory utilization | +0.14 | [+0.01, +0.27] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_idle | memory utilization | +0.07 | [+0.04, +0.11] | 1 | Logs bounds checks dashboard |
| ➖ | python_openmetrics | % cpu utilization | -0.04 | [-0.72, +0.64] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_security_no_fs_load | memory utilization | -0.05 | [-0.11, +0.00] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_idle | memory utilization | -0.13 | [-0.17, -0.09] | 1 | Logs bounds checks dashboard |
| ➖ | quality_gate_idle_all_features | memory utilization | -0.25 | [-0.33, -0.18] | 1 | Logs bounds checks dashboard |
| ➖ | dsd_uds_client_drop_detector_cpu | % cpu utilization | -0.84 | [-1.38, -0.30] | 1 | Logs |
| ➖ | quality_gate_logs | % cpu utilization | -1.33 | [-2.22, -0.44] | 1 | Logs bounds checks dashboard |
</details>
<details>
<summary><h2>
Bounds Checks: ✅ Passed
</h2></summary>
| perf | experiment | bounds_check_name | replicates_passed | observed_value | links |
|------|------------------------------------|-----------------------|-------------------|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ✅ | python_openmetrics | checks_execution_time | 10/10 | 75.68 ≤ 100 | bounds checks dashboard |
| ✅ | python_openmetrics | cpu_usage | 10/10 | 1344.39 ≤ 1500 | bounds checks dashboard |
| ✅ | python_openmetrics | memory_usage | 10/10 | 4.30GiB ≤ 4.75GiB | bounds checks dashboard |
| ✅ | quality_gate_idle | intake_connections | 10/10 | 4 ≤ 5 | bounds checks dashboard |
| ✅ | quality_gate_idle | memory_usage | 10/10 | 177.72MiB ≤ 181MiB | bounds checks dashboard |
| ✅ | quality_gate_idle | total_bytes_received | 10/10 | 764.97KiB ≤ 819.20KiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | 2 ≤ 5 | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | 474.87MiB ≤ 542MiB | bounds checks dashboard |
| ✅ | quality_gate_idle_all_features | total_bytes_received | 10/10 | 1.14MiB ≤ 1.25MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | intake_connections | 10/10 | 17 ≤ 40 | bounds checks dashboard |
| ✅ | quality_gate_logs | memory_usage | 10/10 | 218.31MiB ≤ 228MiB | bounds checks dashboard |
| ✅ | quality_gate_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
| ✅ | quality_gate_logs | total_bytes_received | 10/10 | 263.91MiB ≤ 292MiB | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | 361.45 ≤ 2000 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | 18 ≤ 40 | bounds checks dashboard |
| ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | 424.38MiB ≤ 455MiB | 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 | 74.29MiB ≤ 77MiB | bounds checks dashboard |
| ✅ | quality_gate_security_idle | cpu_usage | 10/10 | 29.39 ≤ 100 | bounds checks dashboard |
| ✅ | quality_gate_security_idle | memory_usage | 10/10 | 329.57MiB ≤ 357MiB | bounds checks dashboard |
| ✅ | quality_gate_security_mean_fs_load | cpu_usage | 10/10 | 41.43 ≤ 200 | bounds checks dashboard |
| ✅ | quality_gate_security_mean_fs_load | memory_usage | 10/10 | 312.75MiB ≤ 337MiB | bounds checks dashboard |
| ✅ | quality_gate_security_no_fs_load | cpu_usage | 10/10 | 24.43 ≤ 100 | bounds checks dashboard |
| ✅ | quality_gate_security_no_fs_load | memory_usage | 10/10 | 322.22MiB ≤ 348MiB | bounds checks dashboard |
</details>
<details>
<summary><h2>
Explanation
</h2></summary>
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".
</details>
CI Pass/Fail Decision
✅ Passed. All Quality Gates passed.
AI review by Codex (OpenAI) - workflow run
The patch is correct. I found no actionable correctness regressions in the send paths, concurrency handling, or partial-failure reporting. Validation is limited to static review; the new task lacks fakeintake E2E coverage.
Approved these changes.
can we move the agent task code out of the rc client? so we don't have the files overlap teams?
Approved these changes.
Approved these changes.
jinh-labs
Hitsuji-M
What does this PR do?
Adds a new
trigger_payloadsAGENT_TASK. When the Agent receives it, it sends some payloads right away instead of waiting for their next scheduled round. Supported payloads areinventory-agent,inventory-host,inventory-checksandagent-health(health platform report). They're picked with a comma-separatedargs.payloadsstring (e.g."inventory-agent,agent-health"); missing or empty means all of them. They're sent in parallel, and one failure doesn't block the others.To support this:
SendNowmethod. It goes through the same send code as their periodic cycle and only skips the scheduling checks.comp/triggerpayloadscomponent.Motivation
Get fresh inventory and agent-health data from an Agent on demand, instead of waiting for the next inventory or health platform interval.
Additional Notes
The dd-source AGENT_TASK schema (
config-validator/schemas/AGENT_TASK/root.json) needs a follow-up addingtrigger_payloadsand theargs.payloadsstring.🤖 Generated with Claude Code