Repository navigation
fix(monitor): classify telemetry endpoints by hostname - #5240
singh4jitendra wants to merge 1 commit into
Conversation
Use shared hostname rules for Google authentication and local collector transport instead of substring checks. Cover deceptive names, loopback addresses, invalid inputs and exporter authentication using local or captured transports.
There was a problem hiding this comment.
Code Review
This pull request introduces robust validation and classification for experimental OpenTelemetry metrics and logging endpoints, replacing basic string matching with structured parsing using net/netip and net/url. It also adds comprehensive unit tests and documentation detailing endpoint authentication and plaintext rules. A review comment correctly identifies that ip.IsLoopback() does not catch IPv4-mapped IPv6 loopback addresses and suggests using ip.Unmap().IsLoopback() to resolve this.
|
Hi @geertj, could you take a look at the telemetry hostname change when you have a moment? Happy to walk through the approach if helpful. Thanks! |
|
Hi @geertj, could you take a look when you have a moment and merge if everything checks out? Thanks! |
|
Hi @geertj, just checking in on the telemetry hostname fix. Could you review it when you have some time and merge if all looks good? Thanks! |
|
Hi @geertj, could you take a look at the telemetry hostname fix when you have a chance? If everything checks out, I'd appreciate your help getting it merged. Thanks! |
|
Hi @geertj, could you take a look at the telemetry hostname fix when you have a moment? Thanks! |
|
Hi @alleaditya, PR #5240 replaces |
Description
The telemetry exporters were using substring checks to decide whether an endpoint is Google-hosted or local. That can misclassify names such as
googleapis.com.collector.exampleandlocalhost.collector.example.This checks the actual hostname instead. Metrics and logging share the same rules, with tests for look-alike domains, regular collectors, and IPv4/IPv6 loopback addresses.
Link to the issue in case of a bug fix.
Fixes #5237
Testing details
Go 1.27.2, Ubuntu 24.04 under WSL.
make build- passed, including vet, lint (0 issues), formatting and compilation.go test -p 1 ./internal/monitor -run '^TestOtelEndpoint(HostnameRules|Authentication)$' -count=1 -json- 21 subcases failed as expected before the fix.go test -mod=readonly -p 1 -count=1 -race -timeout=3m ./internal/monitor- passed after formatting.go test -mod=readonly -p 1 -count=1 -timeout=90s -run '^TestValidateMetrics$' ./cfg- passed.Any backward incompatible change? If so, please explain.
Look-alike remote hostnames no longer receive Google authentication or get treated as local plaintext collectors. Normal Google endpoints, local collectors, the existing IPv4 wildcard behavior, and explicit OTEL transport overrides remain supported. Malformed endpoints return setup errors through the existing exporter error-reporting paths; they do not make mounting fatal.