← Back to Pull requests

[OTAGENT-1367] Resolve hostname without DD_HOSTNAME in standalone DDOT on Kubernetes #57354

Closed
unknown closed this pull request without merging on Oct 02, 2026 08:09 UTC
View on GitHub
unknown unknown commented on Oct 01, 2026 20:58 UTC
Author

What does this PR do?

Standalone DDOT (DD_OTEL_STANDALONE=true) crash-loops in Kubernetes pods unless DD_HOSTNAME is set, on EKS as well as kind. There are two independent failures, both fixed here:

  • The trace config does its own hostname lookup: core agent IPC, then the core agent binary, then os.Hostname(), which it refuses inside a container since #51494. None of that works without a core agent. In standalone mode we now hand it the hostname already resolved by the hostname component.

  • The hostname provider chain finds nothing in a pod. The image never sets DOCKER_DD_AGENT, so the kubelet provider is skipped. The OS hostname is the pod name, and the EC2 provider only runs after another provider found a default ip-... name. The image now sets DOCKER_DD_AGENT=true, and standalone falls back to the EC2 instance ID when running in Kubernetes with no kubernetes_kubelet_host configured. That is the same hostname the core agent reports on EKS.
  • The trace HTTP receiver stays disabled (apm_config.receiver_enabled=false), so marking the image as containerized doesn't open a listener on 0.0.0.0. A test covers that.

    Motivation

    OTAGENT-1367. Following the standalone DDOT Operator docs on EKS fails with unable to reliably determine the host name.

    Tradeoff: the EC2 fallback is used only when the kubelet host is unset. If it is set but the kubelet is failing, startup still fails, so a brief kubelet outage can't flip a custom-named node between two hostnames across restarts.

    Describe how you validated your changes

    Unit tests for the fallback and the trace hostname wiring.

    On an EKS cluster (3 AL2023 + 2 Bottlerocket nodes), I followed the standalone DDOT Operator docs without DD_HOSTNAME. With ddot-collector:7.83.1, every pod crash-looped. I then reran with an image made of ddot-collector:7.83.1 + the otel-agent binary from this branch's pipeline + DOCKER_DD_AGENT=true:

    | Setup | Result |
    | --- | --- |
    | Docs manifest only (no kubelet settings) | All pods running, 0 restarts. Hostname = EC2 instance ID via the fallback, same as the core agent on each node |
    | + kubelet host, TLS verify off, nodes/proxy RBAC | All pods running. The kubelet provider finds the node name and the EC2 provider swaps in the instance ID. No fallback |
    | Kubelet host set, RBAC removed (403) | Startup fails, as intended: no fallback when the kubelet is configured |

    In the running pods, nothing listens on the trace receiver (no :8126, no APM socket).

    🤖 Generated with Claude Code

    [OTAGENT-1367]: https://datadoghq.atlassian.net/browse/OTAGENT-1367?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

    Diff: 348 lines (+261 / -87) across 4 files Reviewer: agagniere Review duration: 670m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.66) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.66 · 348 lines diff across 4 files
    0.66
    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.350
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.066
    Real PR Conversation Timeline
    1 comments
    "Review active on #57354"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    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: 65.6% (HIGH) · Higher = larger blast radius
    65.6%
    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: 25.9% · Safe to merge
    25.9%