Make monitor state polling opt-out via DD_STATE_POLLING_ENABLED #3825
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.42) × (1 − Review Confidence (0.60)).
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.17 · 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.289
Real PR Conversation Timeline
1 comments
"Review active on #3825"
general
weight: 0.35
levan-m
What does this PR do?
CONTP-2338
Adds
DD_STATE_POLLING_ENABLED(defaulttrue), shared by the DatadogMonitor and DatadogGenericResource controllers. When set tofalse:monitorState/stateis set toPollingDisabled, polled timestamps, triggered state and downtime status are cleared, and aStateSynced=Falsecondition with reasonPollingDisabledis added. For GenericResource this applies only to types with live state (monitor, SLO).Re-enabling polling clears
PollingDisabledand refreshes state on the next idle reconcile.If the env var is unset, the operator logs an error at startup, because the default will change to
falsein a future release.Motivation
Reduce Datadog API calls and reconcile churn from per-minute state polling. The Helm chart will control the setting during the transition.
Additional Notes
DD_MONITOR_FORCE_SYNC_PERIODbelow 1 minute now falls back to 60 minutes, matching the GenericResource controller. Otherwise disabled polling would stop monitor requeues.liveStateRefresherinterface; the no-oprefreshStatestubs are removed.Describe your test plan
Unit tests:
go test ./pkg/controller/utils/ ./internal/controller/datadogmonitor/ ./internal/controller/datadoggenericresource/Manual:
1. Deploy the operator with
DD_STATE_POLLING_ENABLED=falseand apply a DatadogMonitor.2.
kubectl get datadogmonitorshowsmonitor state=PollingDisabled.status.conditionshasStateSynced=False, reasonPollingDisabled. Operator logs show no per-minute state refresh.3. Set it to
trueand restart: the real monitor state appears and theStateSyncedcondition is removed.4. Remove the env var and restart: the operator logs an error saying
DD_STATE_POLLING_ENABLEDis not set, and polling stays on.Checklist
bug,enhancement,refactoring,documentation,tooling, and/ordependenciesqa/skip-qalabel[1]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits
🤖 Generated with Claude Code