Skip to content

fix(ssi): wait for RC before inject-all - #55376

Closed
iamluc wants to merge 4 commits into
mainfrom
luc/ssi-inject-all-waits-rc
Closed

fix(ssi): wait for RC before inject-all#55376
iamluc wants to merge 4 commits into
mainfrom
luc/ssi-inject-all-waits-rc

Conversation

@iamluc

@iamluc iamluc commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Description

Do not apply Single Step Instrumentation inject-all until the Cluster Agent has completed a Remote Config round-trip for APM_POLICIES. An empty local cache at subscribe time is not a backend snapshot, so treating it as "no rules" could instrument pods that a remote deny would have skipped. The admission webhook does not block: unmatched pods pass through unchanged until the first snapshot arrives (or is confirmed empty).

Follow-up to #55104.

Related Issue

#55104

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactor / cleanup
  • CI / tooling
  • Documentation

Checklist

  • Documentation updated if needed
  • Tests added or updated
  • No unintended breaking changes

How Has This Been Tested?

Unit tests in pkg/clusteragent/admission/mutate/autoinstrumentation (dda inv test --targets=./pkg/clusteragent/admission/mutate/autoinstrumentation).

Additional Notes

Depends on the matching/RC layering from #55104. This PR is opened against that branch.

Static Helm/Operator targets still match immediately while RC is pending. If Remote Config never syncs, inject-all stays withheld (fail-closed).

@datadog-prod-us1-3

datadog-prod-us1-3 Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 96.55%
Overall Coverage: 55.12% (+0.08%)

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

@dd-octo-sts

dd-octo-sts Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Files inventory check summary

File checks results against ancestor 237a93bf:

Results for datadog-agent_7.84.0~devel.git.634.caa859b.pipeline.134556036-1_amd64.deb:

No change detected

Results for datadog-iot-agent_7.84.0~devel.git.634.caa859b.pipeline.134556036-1_amd64.deb:

No change detected

@dd-octo-sts

dd-octo-sts Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Static quality checks

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

Successful checks

Info

Quality gate Change Size (prev → curr → max)
agent_deb_amd64 +36.0 KiB (0.00% increase, -1.17% of buffer) 762.304 → 762.340 → 765.300
agent_deb_amd64_fips +24.0 KiB (0.00% increase, -1.19% of buffer) 714.566 → 714.589 → 716.540
agent_heroku_amd64 +12.0 KiB (0.00% increase, -0.19% of buffer) 313.501 → 313.513 → 319.540
agent_msi +29.5 KiB (0.00% increase, -0.23% of buffer) 648.437 → 648.465 → 661.050
agent_rpm_amd64 +36.0 KiB (0.00% increase, -1.18% of buffer) 762.288 → 762.323 → 765.270
agent_rpm_amd64_fips +24.0 KiB (0.00% increase, -1.18% of buffer) 714.549 → 714.573 → 716.540
agent_rpm_arm64 +20.0 KiB (0.00% increase, -2.45% of buffer) 738.153 → 738.173 → 738.950
agent_rpm_arm64_fips +20.0 KiB (0.00% increase, -1.87% of buffer) 693.744 → 693.764 → 694.790
agent_suse_amd64 +36.0 KiB (0.00% increase, -1.18% of buffer) 762.288 → 762.323 → 765.270
agent_suse_amd64_fips +24.0 KiB (0.00% increase, -1.18% of buffer) 714.549 → 714.573 → 716.540
agent_suse_arm64 +20.0 KiB (0.00% increase, -2.45% of buffer) 738.153 → 738.173 → 738.950
agent_suse_arm64_fips +20.0 KiB (0.00% increase, -1.87% of buffer) 693.744 → 693.764 → 694.790
docker_agent_amd64 +49.52 KiB (0.01% increase, -6.20% of buffer) 821.320 → 821.369 → 822.100
docker_agent_arm64 +41.51 KiB (0.00% increase, -5.08% of buffer) 822.222 → 822.262 → 823.020
docker_agent_jmx_amd64 +49.51 KiB (0.00% increase, -6.14% of buffer) 1012.233 → 1012.281 → 1013.020
docker_agent_jmx_arm64 +41.52 KiB (0.00% increase, -5.09% of buffer) 1001.914 → 1001.954 → 1002.710
docker_cluster_agent_amd64 +11.61 KiB (0.01% increase, -1.32% of buffer) 211.273 → 211.285 → 212.130
docker_cluster_agent_arm64 +3.64 KiB (0.00% increase, -0.43% of buffer) 224.399 → 224.402 → 225.220
docker_host_profiler_amd64 +41.92 KiB (0.01% increase, -0.38% of buffer) 306.871 → 306.912 → 317.700
docker_host_profiler_arm64 +42.82 KiB (0.01% increase, -0.39% of buffer) 318.168 → 318.210 → 328.970
iot_agent_deb_amd64 +4.0 KiB (0.01% increase, -0.40% of buffer) 46.580 → 46.583 → 47.550
iot_agent_deb_arm64 +4.0 KiB (0.01% increase, -0.39% of buffer) 43.212 → 43.216 → 44.220
iot_agent_deb_armhf +4.0 KiB (0.01% increase, -0.39% of buffer) 44.022 → 44.026 → 45.020
iot_agent_rpm_amd64 +4.0 KiB (0.01% increase, -0.40% of buffer) 46.580 → 46.584 → 47.550
iot_agent_suse_amd64 +4.0 KiB (0.01% increase, -0.40% of buffer) 46.579 → 46.583 → 47.550
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.553 MiB
docker_dogstatsd_arm64 37.623 MiB
dogstatsd_deb_amd64 30.290 MiB
dogstatsd_deb_arm64 28.306 MiB
dogstatsd_rpm_amd64 30.290 MiB
dogstatsd_suse_amd64 30.290 MiB

@iamluc
iamluc force-pushed the luc/ssi-eval-last-wins branch from e2e3081 to a8fb51b Compare August 28, 2026 13:22
@iamluc
iamluc force-pushed the luc/ssi-inject-all-waits-rc branch from 3a1389f to f8e4966 Compare August 28, 2026 15:11
@cit-pr-commenter-54b7da

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

Copy link
Copy Markdown

Regression Detector

Regression Detector Results

Metrics dashboard
Target profiles
Job ID: 8604a4d2-1d02-4281-8aa8-fd0fb77486c0

Baseline: 237a93b
Comparison: caa859b
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.45 [+0.40, +0.50] 1 Logs bounds checks dashboard
quality_gate_security_no_fs_load memory utilization +0.41 [+0.33, +0.50] 1 Logs bounds checks dashboard
dsd_uds_10mb_3k_timestamped_contexts_cpu % cpu utilization +0.23 [-0.01, +0.48] 1 Logs
quality_gate_private_action_runner memory utilization +0.16 [+0.03, +0.29] 1 Logs bounds checks dashboard
quality_gate_idle_all_features memory utilization +0.12 [+0.08, +0.15] 1 Logs bounds checks dashboard
dsd_uds_10mb_3k_timestamped_contexts_memory memory utilization +0.05 [-0.16, +0.26] 1 Logs
quality_gate_security_mean_fs_load memory utilization +0.04 [+0.00, +0.08] 1 Logs bounds checks dashboard
quality_gate_metrics_logs memory utilization -0.21 [-0.44, +0.02] 1 Logs bounds checks dashboard
quality_gate_idle memory utilization -0.29 [-0.34, -0.25] 1 Logs bounds checks dashboard
quality_gate_logs % cpu utilization -0.87 [-1.75, -0.00] 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 172.00MiB ≤ 179MiB bounds checks dashboard
quality_gate_idle total_bytes_received 10/10 747.65KiB ≤ 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 515.45MiB ≤ 537MiB bounds checks dashboard
quality_gate_idle_all_features total_bytes_received 10/10 1.15MiB ≤ 1.25MiB bounds checks dashboard
quality_gate_logs intake_connections 10/10 17 ≤ 40 bounds checks dashboard
quality_gate_logs memory_usage 10/10 209.71MiB ≤ 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.09MiB ≤ 292MiB bounds checks dashboard
quality_gate_metrics_logs cpu_usage 10/10 354.88 ≤ 2000 bounds checks dashboard
quality_gate_metrics_logs intake_connections 10/10 19 ≤ 40 bounds checks dashboard
quality_gate_metrics_logs memory_usage 10/10 418.32MiB ≤ 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 71.72MiB ≤ 75MiB bounds checks dashboard
quality_gate_security_idle cpu_usage 10/10 28.08 ≤ 100 bounds checks dashboard
quality_gate_security_idle memory_usage 10/10 328.91MiB ≤ 355MiB bounds checks dashboard
quality_gate_security_mean_fs_load cpu_usage 10/10 62.25 ≤ 200 bounds checks dashboard
quality_gate_security_mean_fs_load memory_usage 10/10 307.55MiB ≤ 335MiB bounds checks dashboard
quality_gate_security_no_fs_load cpu_usage 10/10 23.46 ≤ 100 bounds checks dashboard
quality_gate_security_no_fs_load memory_usage 10/10 313.96MiB ≤ 345MiB 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_security_no_fs_load, 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_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_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 total_bytes_received: 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 intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_security_idle, 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_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_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.
  • quality_gate_logs, 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_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.
  • quality_gate_idle, 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_private_action_runner, bounds check memory_usage: 10/10 replicas passed. Gate passed.

Base automatically changed from luc/ssi-eval-last-wins to main August 31, 2026 15:46
@iamluc
iamluc force-pushed the luc/ssi-inject-all-waits-rc branch from f8e4966 to 8711468 Compare August 31, 2026 16:08
@github-actions github-actions Bot added the medium review PR review might take time label Aug 31, 2026
@iamluc iamluc added the qa/done QA done before merge and regressions are covered by tests label Aug 31, 2026
Empty GetConfigs at Cluster Agent start is not a round-trip. Applying
inject-all in that window instruments pods a remote deny would skip.
@iamluc
iamluc force-pushed the luc/ssi-inject-all-waits-rc branch from 8711468 to d9bf966 Compare August 31, 2026 16:28
@iamluc
iamluc marked this pull request as ready for review August 31, 2026 16:28
@iamluc
iamluc requested review from a team as code owners August 31, 2026 16:28

@github-actions github-actions Bot 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.

AI review by Codex (OpenAI) - workflow run

Patch is incorrect: it waits for a global RC sync before registering APM_POLICIES, so the sync can complete without fetching that product and incorrectly enable inject-all.

Comment thread pkg/clusteragent/admission/mutate/autoinstrumentation/rc_policies.go Outdated

@datadog-prod-us1-3 datadog-prod-us1-3 Bot 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.

Datadog Autotest: FAIL

A failed first backend Remote Config refresh can still mark the local client as synchronized. This enables inject-all from an empty cache and can ignore an unseen remote deny.

Open Bits AI session

🤖 Datadog Autotest · Commit d9bf966 · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

Comment thread pkg/clusteragent/admission/mutate/autoinstrumentation/rc_policies.go Outdated
Comment on lines +73 to +76
if client.HasSynced() {
m.applySnapshotAndSubscribe(client)
return
}

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.

If nothing has called client.Subscribe(state.ProductApmPolicies, ) then this sync is pretty meaningless for you as you won't get ApmPolicies products without the subscribe. (which I think is what the AI model is calling out below)

If you know something has called subscribe already, then I'm confused about the intent of this code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APM_POLICIES is already in WithProducts when the cluster-agent builds the client, before Start() and before this subscribe. Subscribe would register it if it weren't already there; here it just attaches the callback, the product is already on the wire. HasSynced was just "has that first poll finished?", so we wouldn't treat an empty cache as "no policies" too early.

A global sync flag is still the wrong signal though. It doesn't say which products were actually requested. Dropped it. The mutator now uses SubscribeAll(..., WithInitialUpdate()): you get called once there is an answer for that product (including empty). If a poll that requested it has already completed, that happens during Subscribe; otherwise on the first poll that does.

And the wait is bounded, after a minute we instrument anyway, rather than silently withhold SSI from a configuration that asked for it.

WDYT?

iamluc and others added 2 commits September 1, 2026 12:00
A plain subscription only fires on config changes, so a subscriber
cannot tell "the backend has no configs for me" from "the client has
not asked yet". WithInitialUpdate delivers the product's current state
once: during Subscribe if a poll already carried the product, otherwise
on the first poll that does.

Opt-in per subscription, so subscribers that do not pass it see no
change in behaviour.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Subscribe with WithInitialUpdate so a confirmed-empty APM_POLICIES
snapshot reaches onRemoteConfigUpdate, which is what releases
inject-all, and so a snapshot the client already holds is applied
without waiting for another poll.

A successful poll of the local RC service is not proof that it reached
the backend, so "no answer" cannot be told apart from "no policies".
Bound the wait at one minute and instrument, rather than silently
withhold SSI from a configuration that asked for it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@iamluc

iamluc commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-01T10:31:17.446371Z caa859b Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 381f7d09e8

ℹ️ 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 releasenotes-dca/notes/ssi-inject-all-waits-rc-ef94f1e57ea71908.yaml Outdated
@iamluc

iamluc commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@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: caa859b877

ℹ️ 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".

@ameske
ameske requested a review from wu-jesse September 1, 2026 19:58
@iamluc iamluc closed this Sep 2, 2026
@iamluc
iamluc deleted the luc/ssi-inject-all-waits-rc branch September 2, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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/container-platform The Container Platform Team team/injection-platform team/remote-config

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants