Skip to content

Run system-probe config fixups after BuildSchema - #54738

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
rahul.kaukuntla/fix-system-probe-fixup-init-ordering
Aug 11, 2026
Merged

Run system-probe config fixups after BuildSchema#54738
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
rahul.kaukuntla/fix-system-probe-fixup-init-ordering

Conversation

@rahulkaukuntla

@rahulkaukuntla rahulkaukuntla commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Renames fixupInitSystemProbe to postProcessSystemProbe and moves the call from fixupInitConfig into LoadDatadog, right after useHostEtc.

Motivation

postProcessSystemProbe reads and writes system-probe config keys (apt_config_dir, yum_repos_dir, zypper_repos_dir) to rewrite them under HOST_ETC. It was being called too early on two counts:

  • Before BuildSchema() marks the config ready, so the readiness guard in the getters kicks in and GetSource/GetString silently no-op. Agents logged attempt to read key before config is constructed: system_probe_config.apt_config_dir (and the yum/zypper equivalents) on every start, and the rewrite never applied since GetSource returns SourceUnknown instead of SourceDefault while the config isn't ready.
  • Before useHostEtc runs, so even once that readiness issue is fixed, auto-detected HOST_ETC (as opposed to one set in the env ahead of time) still wouldn't be picked up.

This was introduced in #53983, which changed the function from a no-op into a real implementation without accounting for either ordering constraint.

Describe how you validated your changes

Added a regression test (TestPostProcessSystemProbeRunsAfterConfigIsReady) that runs the real InitConfigObjects() + LoadDatadog() flow with HOST_ETC set and asserts the three keys get rewritten. Confirmed it fails against the old code (reproducing the exact error messages seen in the field) and passes with the fix. Also ran the full pkg/config/setup test suite and linter, no regressions.

Additional Notes

Serverless builds don't call this at all, since they have no system-probe config.

fixupInitSystemProbe reads/writes system-probe config keys, but it was
being called before BuildSchema() marks the config ready. Under
HOST_ETC (containerized deployments), the readiness guard causes
GetSource/GetString to silently no-op, so apt/yum/zypper repo dirs
never got rewritten to point under the host filesystem, and agents
logged "attempt to read key before config is constructed" errors.

Move the call into a new fixupPostBuildConfig(), run after
BuildSchema() on both config objects.
@rahulkaukuntla
rahulkaukuntla requested a review from a team as a code owner August 11, 2026 17:08
@rahulkaukuntla
rahulkaukuntla requested a review from dustmop August 11, 2026 17:08
@dd-octo-sts dd-octo-sts Bot added the internal Identify a non-fork PR label Aug 11, 2026
@rahulkaukuntla rahulkaukuntla added changelog/no-changelog No changelog entry needed qa/done QA done before merge and regressions are covered by tests backport/7.83.x Automatically create a backport PR to the 7.83.x branch once the PR is merged and removed internal Identify a non-fork PR labels Aug 11, 2026
@github-actions github-actions Bot added the medium review PR review might take time label Aug 11, 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: 6c273e78f0

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pkg/config/setup/config.go Outdated
@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 48.15% (-4.16%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 9abe4f6 | Docs | Datadog PR Page | Give us feedback!

Comment thread pkg/config/setup/config_init.go Outdated
@dd-octo-sts

dd-octo-sts Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Static quality checks

✅ Please find below the results from static quality gates
Comparison made with ancestor d1520bc
📊 Static Quality Gates Dashboard
🔗 SQG Job
SOME SIZE DELTAS ARE N/A (ANCESTOR METRICS NOT YET AVAILABLE). RETRY JOB

Successful checks

Info

Quality gate Change Size (prev → curr → max)
agent_deb_amd64 N/A N/A → 759.538 → 764.430
agent_deb_amd64_fips N/A N/A → 712.892 → 715.680
agent_heroku_amd64 N/A N/A → 312.272 → 318.990
agent_msi N/A N/A → 643.216 → 660.900
agent_rpm_amd64 N/A N/A → 759.522 → 764.400
agent_rpm_amd64_fips N/A N/A → 712.876 → 715.680
agent_rpm_arm64 N/A N/A → 735.499 → 736.490
agent_rpm_arm64_fips N/A N/A → 692.112 → 693.640
agent_suse_amd64 N/A N/A → 759.522 → 764.400
agent_suse_amd64_fips N/A N/A → 712.876 → 715.680
agent_suse_arm64 N/A N/A → 735.499 → 736.490
agent_suse_arm64_fips N/A N/A → 692.112 → 693.640
docker_agent_amd64 N/A N/A → 818.162 → 819.970
docker_agent_arm64 N/A N/A → 819.175 → 820.690
docker_agent_jmx_amd64 N/A N/A → 1009.059 → 1010.730
docker_agent_jmx_arm64 N/A N/A → 998.725 → 1000.370
docker_cluster_agent_amd64 N/A N/A → 210.346 → 211.300
docker_cluster_agent_arm64 N/A N/A → 223.393 → 223.810
docker_cws_instrumentation_amd64 N/A N/A → 7.439 → 7.480
docker_cws_instrumentation_arm64 N/A N/A → 6.877 → 7.110
docker_dogstatsd_amd64 N/A N/A → 39.474 → 39.960
docker_dogstatsd_arm64 N/A N/A → 37.560 → 38.270
docker_host_profiler_amd64 N/A N/A → 305.804 → 317.690
docker_host_profiler_arm64 N/A N/A → 317.122 → 328.970
dogstatsd_deb_amd64 N/A N/A → 30.216 → 31.200
dogstatsd_deb_arm64 N/A N/A → 28.239 → 29.580
dogstatsd_rpm_amd64 N/A N/A → 30.216 → 31.200
dogstatsd_suse_amd64 N/A N/A → 30.216 → 31.200
iot_agent_deb_amd64 N/A N/A → 46.420 → 46.440
iot_agent_deb_arm64 N/A N/A → 43.095 → 43.770
iot_agent_deb_armhf N/A N/A → 43.875 → 44.020
iot_agent_rpm_amd64 N/A N/A → 46.420 → 46.440
iot_agent_suse_amd64 N/A N/A → 46.419 → 46.440

@cit-pr-commenter-54b7da

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

Copy link
Copy Markdown

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Run ID: 5998d436-ad56-4531-ad0a-f3dab1e968e0

Baseline: ca45c2b
Comparison: d019929
Diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI trials links
quality_gate_security_idle memory utilization +0.15 [+0.04, +0.25] 1 Logs bounds checks dashboard
quality_gate_metrics_logs memory utilization +0.08 [-0.16, +0.33] 1 Logs bounds checks dashboard
quality_gate_security_no_fs_load memory utilization +0.01 [-0.14, +0.15] 1 Logs bounds checks dashboard
quality_gate_idle memory utilization -0.04 [-0.16, +0.07] 1 Logs bounds checks dashboard
quality_gate_security_mean_fs_load memory utilization -0.07 [-0.14, +0.01] 1 Logs bounds checks dashboard
quality_gate_private_action_runner memory utilization -0.07 [-0.19, +0.04] 1 Logs bounds checks dashboard
quality_gate_idle_all_features memory utilization -0.33 [-0.37, -0.28] 1 Logs bounds checks dashboard
quality_gate_logs % cpu utilization -1.08 [-1.92, -0.23] 1 Logs bounds checks dashboard

Bounds Checks: ❌ Failed

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 0/10 173.10MiB > 154MiB bounds checks dashboard
quality_gate_idle total_bytes_received 10/10 731.88KiB ≤ 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 511.01MiB ≤ 512MiB 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 17 ≤ 40 bounds checks dashboard
quality_gate_logs memory_usage 0/10 204.55MiB > 195MiB bounds checks dashboard
quality_gate_logs missed_bytes 10/10 0B = 0B bounds checks dashboard
quality_gate_logs total_bytes_received 10/10 264.17MiB ≤ 292MiB bounds checks dashboard
quality_gate_metrics_logs cpu_usage 10/10 353.88 ≤ 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 403.36MiB ≤ 430MiB 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.66MiB ≤ 75MiB bounds checks dashboard
quality_gate_security_idle cpu_usage 10/10 24.77 ≤ 100 bounds checks dashboard
quality_gate_security_idle memory_usage 10/10 326.62MiB ≤ 330MiB bounds checks dashboard
quality_gate_security_mean_fs_load cpu_usage 10/10 61.34 ≤ 200 bounds checks dashboard
quality_gate_security_mean_fs_load memory_usage 10/10 300.76MiB ≤ 310MiB bounds checks dashboard
quality_gate_security_no_fs_load cpu_usage 10/10 21.27 ≤ 100 bounds checks dashboard
quality_gate_security_no_fs_load memory_usage 10/10 312.05MiB ≤ 320MiB 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".

Replicate Execution Details

We run multiple replicates for each experiment/variant. However, we allow replicates to be automatically retried if there are any failures, up to 8 times, at which point the replicate is marked dead and we are unable to run analysis for the entire experiment. We call each of these attempts at running replicates a replicate execution. This section lists all replicate executions that failed due to the target crashing or being oom killed.

Note: In the below tables we bucket failures by experiment, variant, and failure type. For each of these buckets we list out the replicate indexes that failed with an annotation signifying how many times said replicate failed with the given failure mode. In the below example the baseline variant of the experiment named experiment_with_failures had two replicates that failed by oom kills. Replicate 0, which failed 8 executions, and replicate 1 which failed 6 executions, all with the same failure mode.

Experiment Variant Replicates Failure Logs Debug Dashboard
experiment_with_failures baseline 0 (x8) 1 (x6) Oom killed Debug Dashboard

The debug dashboard links will take you to a debugging dashboard specifically designed to investigate replicate execution failures.

❌ Retried Profiling Replicate Execution Failures (ddprof)

Note: Profiling replicas may still be executing. See the debug dashboard for up to date status.

Experiment Variant Replicates Failure Debug Dashboard
quality_gate_idle comparison 10 Oom killed Debug Dashboard
quality_gate_metrics_logs baseline 10 Oom killed Debug Dashboard
quality_gate_metrics_logs comparison 10 Oom killed Debug Dashboard
quality_gate_security_idle baseline 10 Crashed (exit code: 134) Debug Dashboard
quality_gate_security_no_fs_load comparison 10 Crashed (exit code: 134) Debug Dashboard

CI Pass/Fail Decision

Failed. Some Quality Gates were violated.

  • quality_gate_logs, bounds check intake_connections: 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: 0/10 replicas passed. Failed 10 which is > 0. Gate FAILED.
  • quality_gate_logs, bounds check missed_bytes: 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_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_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_idle_all_features, bounds check memory_usage: 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_idle, bounds check memory_usage: 0/10 replicas passed. Failed 10 which is > 0. Gate FAILED.
  • quality_gate_idle, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, bounds check intake_connections: 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 missed_bytes: 10/10 replicas passed. Gate 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 intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_private_action_runner, bounds check memory_usage: 10/10 replicas passed. Gate passed.

Address review feedback: the fixup needs to run after HOST_ETC has
been determined (useHostEtc), not just after BuildSchema, otherwise
auto-detected HOST_ETC (as opposed to an env var set ahead of time)
is never picked up. Move the call into LoadDatadog, right after
useHostEtc, and rename fixupInitSystemProbe to postProcessSystemProbe
since it no longer runs during the fixupInit phase.
@rahulkaukuntla
rahulkaukuntla requested a review from a team as a code owner August 11, 2026 18:40
@dd-octo-sts dd-octo-sts Bot added internal Identify a non-fork PR team/agent-build labels Aug 11, 2026
@rahulkaukuntla
rahulkaukuntla requested a review from dustmop August 11, 2026 18:44

@dustmop dustmop left a comment

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.

Thanks for fixing, LGTM

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit d019929 into main Aug 11, 2026
314 of 322 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the rahul.kaukuntla/fix-system-probe-fixup-init-ordering branch August 11, 2026 21:00
@temporal-github-worker-1

Copy link
Copy Markdown
Contributor

Backport evaluation: View Slack thread

@github-actions github-actions Bot added this to the 7.84.0 milestone Aug 11, 2026
gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Aug 11, 2026
…54752)

Backport d019929 from #54738.

 ___

### What does this PR do?

Renames `fixupInitSystemProbe` to `postProcessSystemProbe` and moves the call from `fixupInitConfig` into `LoadDatadog`, right after `useHostEtc`.

### Motivation

`postProcessSystemProbe` reads and writes system-probe config keys (`apt_config_dir`, `yum_repos_dir`, `zypper_repos_dir`) to rewrite them under `HOST_ETC`. It was being called too early on two counts:

- Before `BuildSchema()` marks the config ready, so the readiness guard in the getters kicks in and `GetSource`/`GetString` silently no-op. Agents logged `attempt to read key before config is constructed: system_probe_config.apt_config_dir` (and the yum/zypper equivalents) on every start, and the rewrite never applied since `GetSource` returns `SourceUnknown` instead of `SourceDefault` while the config isn't ready.
- Before `useHostEtc` runs, so even once that readiness issue is fixed, auto-detected `HOST_ETC` (as opposed to one set in the env ahead of time) still wouldn't be picked up.

This was introduced in #53983, which changed the function from a no-op into a real implementation without accounting for either ordering constraint.

### Describe how you validated your changes

Added a regression test (`TestPostProcessSystemProbeRunsAfterConfigIsReady`) that runs the real `InitConfigObjects()` + `LoadDatadog()` flow with `HOST_ETC` set and asserts the three keys get rewritten. Confirmed it fails against the old code (reproducing the exact error messages seen in the field) and passes with the fix. Also ran the full `pkg/config/setup` test suite and linter, no regressions.

### Additional Notes

Serverless builds don't call this at all, since they have no system-probe config.

Co-authored-by: sabrina.lu <sabrina.lu@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/7.83.x Automatically create a backport PR to the 7.83.x branch once the PR is merged changelog/no-changelog No changelog entry needed internal Identify a non-fork PR medium review PR review might take time qa/done QA done before merge and regressions are covered by tests team/agent-build team/fleet-automation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants