← Back to Pull requests

Send Operator events through the v2 Events API #3872

Closed
unknown closed this pull request without merging on Dec 01, 2026 15:37 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 15:33 UTC
Author

What does this PR do?

Sends the metrics forwarder's custom resource events (Detect Custom Resource … / Delete Custom Resource …) through the v2 Events API instead of v1.

  • POST https://event-management-intake.<site>/api/v2/events (v2 intake is on its own host). An explicit spec.global.endpoint.url / DD_URL / DD_DD_URL is used as-is.

  • change category event with changed_resource: {type: configuration, name: <Kind/namespace/name>}; title and tags are unchanged

  • integration_id: system, so events keep the Datadog source and source:datadog tag that v1 events had (without it, v2 attributes them to "My Apps"). The value isn't in the API client's enum but is accepted by the intake.
  • Motivation

    CONS-12113: orgs not enabled for v1 event ingestion get 403 Forbidden (This organization is not enabled for the v1 events API. Submit events with POST /api/v2/events instead.) whenever a forwarder starts.

    Additional Notes

    Proxies or URL overrides set through spec.global.endpoint.url / DD_URL must route /api/v2/events to event-management-intake.<site>.

    Minimum Agent Versions

    N/A (Operator only).

    Describe your test plan

    Unit tests cover the events URL per site and the request URL, API key header and payload shape.

    <details>
    <summary>QA steps</summary>

    1. Deploy this Operator build and apply a DatadogAgent with a unique cluster name and valid credentials:

       apiVersion: datadoghq.com/v2alpha1
       kind: DatadogAgent
       metadata:
         name: datadog
         namespace: datadog
       spec:
         global:
           clusterName: <unique-name>
           site: datadoghq.com
           credentials:
             apiSecret: {secretName: datadog-secret, keyName: api-key}
             appSecret: {secretName: datadog-secret, keyName: app-key}
       

    2. In Event Management, search kube_cluster_name:<unique-name>. Expect Detect Custom Resource DatadogAgent/datadog/datadog and Detect Custom Resource DatadogAgentInternal/datadog/datadog, both with Source Datadog.
    3. Delete the DatadogAgent and expect the matching Delete Custom Resource … events.
    4. The Operator logs should contain no an error occurred while sending event.

    </details>

    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

    🤖 Generated with Claude Code

    [CONS-12113]: https://datadoghq.atlassian.net/browse/CONS-12113?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

    Diff: 353 lines (+264 / -89) across 4 files Reviewer: levan-m Review duration: 1443m
    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 · 353 lines diff across 4 files
    0.42
    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.351
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3872"
    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: 42.5% (MEDIUM) · Higher = larger blast radius
    42.5%
    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: 16.8% · Safe to merge
    16.8%