← Back to Pull requests

[CONTP-2162] Standardize reconcile log fields across controllers #3713

Closed
unknown closed this pull request without merging on Nov 02, 2026 15:21 UTC
View on GitHub
unknown unknown commented on Nov 02, 2026 13:23 UTC
Author

What does this PR do?

Standardizes reconcile logs for DatadogAgent, DatadogAgentInternal, DatadogGenericResource, DatadogMonitor, DatadogDashboard, DatadogSLO, and DatadogAgentProfile on flat namespace/name fields and the controllers.<Kind> logger name. A shared log constructor applies the same format to controller-runtime messages, including Reconciler error, and reconciler code uses the context logger to retain reconcileID.

Removes redundant identity fields and the encoder's special case for the nested DDAI field. Adds registered-controller coverage for identity, logger names, duplicate fields, and reconcile correlation.

Motivation

CONTP-2162. CONTP-2142 already removed the DDA duplication and established flat identity fields. This completes the remaining consistency work for the other controllers listed in the ticket.

Additional Notes

Log query compatibility: queries using datadogmonitor., datadogdashboard., datadogslo., datadogagentprofile., nested kind objects, or Monitor Namespace/Monitor Name must migrate to flat namespace/name, scoped by logger. DDA and GenericResource already use flat identity fields.

Controller metadata remains available to custom loggers. The default encoder continues to suppress controller, controllerGroup, and controllerKind. Custom loggers that previously exposed the nested DatadogAgentInternal field now use the flat fields too.

Release note: Reconcile logs for the seven controllers above now consistently identify resources with flat namespace and name attributes and use controllers.<Kind> logger names on both reconciler and controller-runtime messages. Update queries using the removed resource-specific identity attributes.

Minimum Agent Versions

No new minimum Agent or Cluster Agent version requirements.

Describe your test plan

Across 144 JSON log entries:
DDA, DDAI, Monitor, and GenericResource consistently use controllers.<Kind>, flat namespace/name, and reconcileID.
No duplicate keys or legacy identity fields.
Each reconcile ID maps to one consistent resource identity.
Successful Monitor creation logs also match. No warnings or errors appeared.

{
  "level": "INFO",
  "ts": "2026-11-02T13:31:46.062Z",
  "logger": "controllers.DatadogMonitor",
  "msg": "Created a new DatadogMonitor",
  "namespace": "system",
  "name": "datadog-monitor-test",
  "reconcileID": "06f641ec-8dfb-47b5-8f54-b156312f6001",
  "Monitor ID": 339772707
}
{
  "level": "INFO",
  "ts": "2026-11-02T13:31:46.155Z",
  "logger": "DatadogMetricForwarders",
  "msg": "Datadog metrics forwarder initialized successfully",
  "kind": "DatadogMonitor",
  "namespace": "system",
  "name": "datadog-monitor-test",
  "url": "https://api.datadoghq.com"
}
{
  "level": "INFO",
  "ts": "2026-11-02T13:31:48.677Z",
  "logger": "controllers.DatadogAgent",
  "msg": "Reconciling DatadogAgent",
  "namespace": "system",
  "name": "datadog-agent",
  "reconcileID": "3cffa750-a992-4a19-aa13-328b29b57a5f"
}
{
  "level": "INFO",
  "ts": "2026-11-02T13:31:48.970Z",
  "logger": "controllers.DatadogAgentInternal",
  "msg": "Reconciling DatadogAgentInternal",
  "namespace": "system",
  "name": "datadog-agent",
  "reconcileID": "e4957585-172b-454f-8564-83ebf240bc68"
}

Checklist

  • PR has at least one valid label: bug, enhancement, refactoring, documentation, tooling, and/or dependencies

  • PR has a milestone or the qa/skip-qa label

  • All commits are signed (see: [signing commits][1])
  • [1]: https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

    [CONTP-2162]: https://datadoghq.atlassian.net/browse/CONTP-2162?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

    Diff: 491 lines (+368 / -123) across 6 files Reviewer: khewonc Review duration: 117m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.47) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 491 lines diff across 6 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.371
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3713"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.4% (MEDIUM) · Higher = larger blast radius
    47.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.7% · Safe to merge
    18.7%