Repository navigation
fix(telemetry): the registrar, controller and edge control plane no longer report their pod name as host.name, and the otel.endpoint row no longer names the CNI plugin (#1596, #1614) - #1618
Merged
Conversation
…onger report their pod name as host.name, and the otel.endpoint row no longer names the CNI plugin (#1596, #1614) common/telemetry/setup kept the OTel host detector for every component built on it. The node agent is hostNetwork, so its host.name is the node's. The registrar, the controller and the edge control plane are on the pod network, so theirs was the pod name: the resource #1041 fixed for the prober, where a collector promoted host.name to the node label ahead of k8s.node.name. The package is shared by both kinds, so it cannot choose. setup.Config and manager.Config gain WithoutHostName (zero value: host.name kept, as before), and the three components that are not hostNetwork set it: NewRegistrarConfig, NewControllerConfig, and the edge in the PersistentPreRunE it shares with the node agent (applyEdgeTelemetry, agent/internal/cmd/edge.go), before the logger's provider is built. manager.Config.Telemetry is now the one mapping from a component's manager configuration to its telemetry setup; the logger's provider used a second, shorter literal. setup.NewResource is exported so each component pins its own resource in its own package. Docs: metric-labels.md says which component sets host.name; configuration.md and getting-started.md no longer say the collector endpoint is baked into the CNI plugin, which exports no telemetry of its own since #1166/#1185. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
There was a problem hiding this comment.
🟡 Changes recommended
The corrected OTLP guidance still conflicts with the obsolete documentation in the chart values file.
1 open finding
What changed in this PR
Removes misleading host.name telemetry from pod-network control-plane components and corrects OTLP endpoint documentation.
Changes:
- Adds caller-controlled host detection and applies it to registrar, controller, and edge telemetry.
- Centralizes manager-to-telemetry configuration mapping.
- Adds regression tests and updates observability documentation.
| File | Description |
|---|---|
registrar/internal/cmd/telemetry_test.go |
Tests registrar resource attributes. |
registrar/internal/cmd/config.go |
Disables registrar host detection. |
registrar/internal/cmd/BUILD.bazel |
Registers telemetry test dependencies. |
controller/internal/cmd/telemetry_test.go |
Tests controller resource attributes. |
controller/internal/cmd/config.go |
Disables controller host detection. |
controller/internal/cmd/BUILD.bazel |
Registers telemetry test dependencies. |
agent/internal/cmd/telemetry_test.go |
Tests agent and edge host behavior. |
agent/internal/cmd/root.go |
Applies edge-specific telemetry configuration. |
agent/internal/cmd/edge.go |
Defines edge host-detection behavior. |
agent/internal/cmd/BUILD.bazel |
Registers telemetry test dependencies. |
common/telemetry/setup/setup.go |
Adds configurable host omission and exports resource creation. |
common/telemetry/setup/logs.go |
Uses the shared resource builder. |
common/telemetry/setup/tracing.go |
Uses the shared resource builder. |
common/telemetry/setup/resource_test.go |
Tests both host-detection modes. |
common/manager/config.go |
Centralizes telemetry configuration mapping. |
common/manager/config_test.go |
Tests the configuration mapping. |
common/manager/manager.go |
Uses centralized telemetry configuration. |
common/manager/logging.go |
Uses centralized logging resource configuration. |
common/manager/BUILD.bazel |
Includes the new configuration test. |
docs/observability/metric-labels.md |
Documents host attributes per component. |
docs/getting-started.md |
Corrects OTLP endpoint behavior. |
docs/configuration.md |
Corrects endpoint and host-name documentation. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Closes #1596
Closes #1614
Operator-visible change: the telemetry resource of the registrar, the controller and the edge control plane (
agent edge) no longer carrieshost.name, on all three signals (metrics, logs, traces). It held their pod name. A pipeline that selected or grouped those components by a label made fromhost.nameusesk8s.pod.nameinstead, which the chart already sets on all three and which holds the same value. The node agent, mesh-dns and the proxy supervisor are unchanged: they arehostNetworkand theirhost.nameis the node's.#1596: the premise, per component
The issue was inferred from the code. A test per component came first, each reading the resource built from that component's own configuration, and was run against the unchanged behaviour:
hostNetworkhost.namebeforeagent-daemonset.yamledge-deployment.yamlregistrar-deployment.yamlcontroller-deployment.yamlThe node agent's case (
the_node_agent_is_hostNetwork_and_keeps_host.name) was green before and is green after. mesh-dns and the proxy supervisor do not usecommon/telemetry/setup; their existingTestResourceHostName(#1592) still pins that they keep it.What was measured: the resource each component builds, in a unit test. What was not: no collector output was checked, and no pod was run. "In that pod the hostname is the pod name" is Kubernetes' behaviour for a pod that is not
hostNetwork, not something this PR observed.The change
common/telemetry/setupis shared byhostNetworkand pod-network components, so it cannot choose, and its default does not change. The caller says so:setup.Config.WithoutHostNameandmanager.Config.WithoutHostName(not a flag; zero value keepshost.name).setup.NewResourcepassesserviceresource.WithoutHost()(fix(telemetry): a service.version in OTEL_RESOURCE_ATTRIBUTES no longer replaces the build's, and the four resource builders are one (#1575, #1576) #1592) when it is set.registrar/internal/cmd(NewRegistrarConfig) andcontroller/internal/cmd(NewControllerConfig) set it.agent/internal/cmd/edge.go:applyEdgeTelemetry. The edge shares the node agent'scfgand itsPersistentPreRunE, which is where the logger's provider is built, so that hook calls it before the logger exists and it changes the configuration only when the command isedge.Two things moved to make each component testable in its own package, with no behaviour change:
manager.Config.Telemetry(name, version)is the one mapping from a component's manager configuration to itssetup.Config.BootstrapandSetupManagerLoggingeach had a literal; the logger's was a shorter copy, which is where a new field would have been forgotten.setup.newResourceis exported assetup.NewResource.What replaces
host.namefor these threeNothing needs to.
k8s.pod.nameis already on all three resources (from the chart'sOTEL_RESOURCE_ATTRIBUTES) and holds the valuehost.nameheld. Open PR #1595 also addsservice.instance.id=$(POD_NAME)to exactly these three, which Prometheus stores asinstance. So the pod name is on the resource once now and twice after #1595;host.namewas a third copy under a name that says "host".docs/observability/metric-labels.mdgets a per-componenthost.nametable in place of the sentence that said every Go component but the prober sets it. It does not mentionservice.instance.idfor these components: that is #1595's to say. Both PRs edit that file; the second to merge will have a textual conflict in the list above "Labels that are not your pipeline's job" (this PR rewrites the last bullet, #1595 the ones before it).#1614
docs/configuration.md,otel.endpoint: the row said the value is baked into the CNI plugin and that an empty value disables "the proxy/CNI stat sink". The CNI plugin takes no endpoint and exports nothing since #1166/#1185. The row now says who receives the value (each Go component as--otlp-endpoint, and the two Envoy bootstraps) and points at thecniInstallsection, which already had it right.The same sentence was in
docs/getting-started.md("Observability"); corrected there too.charts/aether/values.yamlhas it a third time in a comment, which this PR leaves alone: it changes nothing undercharts/.Tests
TestTelemetryResourceHasNoHostNameinregistrar/internal/cmdandcontroller/internal/cmd: the package's owncfg, the one the command builds its providers from.TestTelemetryResourceHostNameinagent/internal/cmd: runs the sharedPersistentPreRunEfor the root command and foredge, then reads the resource.TestResourceHostNameincommon/telemetry/setup, now two cases: the default keeps it,WithoutHostNamedrops it and nothing else.TestConfigTelemetryincommon/manager: every field of the mapping.Mutations, each reverted:
NewRegistrarConfigdoes not set itNewControllerConfigdoes not set itapplyEdgeTelemetrydoes nothingPersistentPreRunEdoes not call itapplyEdgeTelemetryapplies to every commandConfig.Telemetrydrops the fieldTestConfigTelemetry, and all three componentssetup.NewResourceignores the fieldTestResourceHostName, and all three componentssetup.NewResourcedropshost.nameby defaultTestResourceHostName, and the node agent caseNot covered by a test: that
SetupManagerLoggingbuilds its provider fromConfig.Telemetryand not from a literal of its own. The provider's resource is not readable from outside it.Guards
//agent/cmd/...(everydeps_test, and the agent, mesh-dns, proxy-supervisor and uds-csiimage_test),//controller/cmd/controller:image_test,//registrar/cmd/registrar:image_test: green. No library gains an import (common/manageralready importedcommon/telemetry/setup).bazel test //test/harnesscontract/...: green. Nothing there is edited, and no name in the contract changes.--config=race --build_tests_onlyon the five touchedgo_testtargets: green.make format-check,make go-build-plain(136 packages, none excluded): green.No chart, no workflow, no proto change.
An agent wrote this pull request.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr