Resolve the DDOT standalone hostname without the kubelet #59017
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
truthbk
<!--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
use_kubelet_collector: falsein thedogtelextension config, where the nodefilter workloadmeta collector watches pods through the Kubernetes API server instead)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_varenvironment variables first, even whenuse_kubelet_collectoris true, through a nodename package now shared with the nodefilter collector. Fall back to the kubelet only whenuse_kubelet_collectoris true.1. For the cluster name, these sources are checked in this order:
-
cluster_name(set viaDD_CLUSTER_NAMEenv var)- cloud providers' APIs
- node labels, only when
use_kubelet_collectoris true-
k8s.cluster.nameinservice.telemetry.resourcein the collector config-
k8s.cluster.nameresource attribute inOTEL_RESOURCE_ATTRIBUTESThe 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
pkg/util/kubelet), cluster name order includingservice.telemetry.resourceandOTEL_RESOURCE_ATTRIBUTES(pkg/util/kubernetes/clustername,cmd/otel-agent/config), host aliases and cloud provider name without kubelet access.otel-agent-devimage and pods-only RBAC (nonodes/proxy):- before: otel-agent exits with "unable to reliably determine the host name"
- after: the hostname is
<node>-<cluster>fromK8S_NODE_NAMEandk8s.cluster.name, with zero kubelet requests over a 7-minute runTestDogtelHostnameWithoutKubelet, which checks thatotel.ddot_collector.metrics.runningcarries<node>-dogtel-standalone-e2eas its host.Additional Notes
Will close
[OTAGENT-1385]: https://datadoghq.atlassian.net/browse/OTAGENT-1385?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ