← Back to Pull requests

[CONTP-2222] Add operator user agent to Datadog API clients #3658

Closed
unknown closed this pull request without merging on Oct 26, 2026 08:51 UTC
View on GitHub
unknown unknown commented on Oct 26, 2026 08:23 UTC
Author

What does this PR do?

Set User-Agent: datadog-operator/<version> on Datadog API requests from all resource controllers, metrics/events forwarding, and credential validation. Centralize client construction in datadogclient.NewAPIClient.

Motivation

Identify requests from the Datadog Operator and their originating version, following the cluster-agent user-agent naming convention.

Additional Notes

The existing build version is used unchanged. Make-based untagged local and nightly builds use the short Git commit; tagged builds use the release tag. Direct go build/go run without linker flags retains the existing 0.0.0 default.

Commit hashes and SemVer strings (including release candidates and build metadata) are valid HTTP user-agent product versions. HTTP tests verify the header arrives unchanged. Explicit malformed VERSION overrides are outside this change's scope.

Minimum Agent Versions

Agent: No minimum version required.
Cluster Agent: No minimum version required.

Describe your test plan

  • HTTP tests cover every resource client with release versions, release candidates, SemVer build metadata, short/full commit hashes, and the actual build version.

  • Tests pass for pkg/datadogclient, pkg/controller/utils/datadog, and the monitor, SLO, dashboard, and generic resource controller packages.

  • Client tests also pass with linker-injected release-candidate and commit versions.

  • make managergobuild and manager --version confirm the default local build embeds the short commit.

  • make lint passes (including go vet).
  • 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

    Diff: 242 lines (+181 / -61) across 3 files Reviewer: wdhif Review duration: 28m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 242 lines diff across 3 files
    0.39
    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.329
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #3658"
    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: 38.8% (MEDIUM) · Higher = larger blast radius
    38.8%
    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: 15.3% · Safe to merge
    15.3%