← Back to Pull requests

Resolve the DDOT standalone hostname without the kubelet #59017

Closed
unknown closed this pull request without merging on Oct 28, 2026 21:04 UTC
View on GitHub
unknown unknown commented on Oct 27, 2026 14:29 UTC
Author

<!--Please give us some feedback on your experience writing this PR ! https://app.datadoghq.com/forms/43db4c02-6837-400c-8083-692e141b1b88 !-->

Motivation

In standalone mode on Kubernetes, we want DDOT to be able to resolve its hostname, even when

  • kubelet access isn't provided (use_kubelet_collector: false in the dogtel extension config, where the nodefilter workloadmeta collector watches pods through the Kubernetes API server instead)

  • outside managed cloud, where the cluster name cannot be auto-discovered. It is important for the hostname to contain the cluster name as a suffix
  • In such a situation, we will expect the node name to come from the downward API via an env var, and the cluster name to be manually provided via an env var or the collector config.

    What does this PR do?

    1. Read the node name from the otelcollector.standalone.node_from_env_var environment variables first, even when use_kubelet_collector is true, through a nodename package now shared with the nodefilter collector. Fall back to the kubelet only when use_kubelet_collector is true.
    1. For the cluster name, these sources are checked in this order:
    - cluster_name (set via DD_CLUSTER_NAME env var)
    - cloud providers' APIs
    - node labels, only when use_kubelet_collector is true
    - k8s.cluster.name in service.telemetry.resource in the collector config
    - k8s.cluster.name resource attribute in OTEL_RESOURCE_ATTRIBUTES

    The resource attribute value is lowercased and normalized like the other sources (_ → -).
    1. Without kubelet access, host metadata no longer contacts the kubelet either: the host alias detectors that need it are skipped, and the Kubernetes cloud provider name lookup returns early.

    Other flavors and connected mode are unchanged.

    Describe how you validated your changes

  • Unit tests for each step: node name from env vars and kubelet fallbacks (pkg/util/kubelet), cluster name order including service.telemetry.resource and OTEL_RESOURCE_ATTRIBUTES (pkg/util/kubernetes/clustername, cmd/otel-agent/config), host aliases and cloud provider name without kubelet access.

  • Manually on k3s with the otel-agent-dev image and pods-only RBAC (no nodes/proxy):

  • - before: otel-agent exits with "unable to reliably determine the host name"
    - after: the hostname is <node>-<cluster> from K8S_NODE_NAME and k8s.cluster.name, with zero kubelet requests over a 7-minute run
  • E2E: added TestDogtelHostnameWithoutKubelet, which checks that otel.ddot_collector.metrics.running carries <node>-dogtel-standalone-e2e as its host.
  • Additional Notes

    Will close

  • OTAGENT-1385

  • OTAGENT-1373

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

    Diff: 377 lines (+282 / -95) across 4 files Reviewer: truthbk Review duration: 1835m
    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 · 377 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.355
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.066
    Real PR Conversation Timeline
    1 comments
    "Review active on #59017"
    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: 66.1% (HIGH) · Higher = larger blast radius
    66.1%
    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: 26.1% · Safe to merge
    26.1%