feat(clusteragent/appsec): add appsec_injector.enabled telemetry gauge #60996
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.42) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 330 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.347
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #60996"
general
weight: 0.35
adel121
What does this PR do?
Adds an
appsec_injector.enabledgauge, tagged withproxy_typeandmode, and adds it to thecluster-agentagent telemetry profile. It is set to 1 when the injector starts running for a proxy type (afterIsInjectionPossiblesucceeds, before the leader wait), and removed when it stops. Every cluster-agent replica reports it, leader or not.Sidecar-mode proxy types mutate pods only through the admission webhook, which does not run when
admission_controller.enabledis false. They are reported only when the admission controller is enabled.Motivation
The only AppSec injector telemetry today is two counters,
appsec_injector.watched_changesandappsec_injector.sidecar_mutations. They show activity, not whether the injector is enabled: a cluster with the injector on but no gateway changes or pod admissions reports nothing. Counting clusters by their presence only worked because counters that had moved once were sent with a value of0in every later payload, and #60331 stops that forzero_metricprofiles. A gauge is not delta-converted, so it keeps reporting while the injector runs.Describe how you validated your changes
TestRun_reportsEnabledGaugeWhileRunningruns the injector as a non-leader in external mode, sidecar mode with the admission controller, and sidecar mode without it. Oncerunfirst checks leadership, it checks the gauge is 1 for the first two and absent for the third, then cancels and checks the series is removed.TestRun_logsNotApplicableSkipAtInfochecks, from insideIsInjectionPossibleand afterrunreturns, that a proxy type skipped as not applicable is never reported.TestDefaultProfilesExportAppsecInjectorEnabledGaugeruns the shipped default profiles through the collection path and checks the sent payload hasappsec_injector.enabled= 1 withproxy_typeandmode.Setmoves beforeIsInjectionPossible, or the profile dropspreserve_tags.dda inv test --targets=./pkg/clusteragent/appsec,./comp/core/agenttelemetry/implpasses,dda inv linter.goreports no issues on both packages, and gazelle is clean.Additional Notes
COAT payloads carry
@org_idand the replica's@metrics.agent_metadata.hostid, but no cluster identifier, so replicas of one cluster cannot be deduplicated. Count orgs, for examplecardinality(@org_id)overservice:trace-events-writer-agent-telemetry @metrics.appsec_injector.enabled.value:*. Countinghostidcounts cluster-agent replicas, not clusters.The gauge only appears from the release that ships this change.