feat: move dns lookup to run independently#3654
Open
0xzrf wants to merge 1 commit intomalbeclabs:mainfrom
Open
feat: move dns lookup to run independently#36540xzrf wants to merge 1 commit intomalbeclabs:mainfrom
0xzrf wants to merge 1 commit intomalbeclabs:mainfrom
Conversation
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.
Summary of Changes
Describe what changed in the PR
Introduced a
DeliveryDNSRefresherthat runs DNS for result-destinationhost:portstrings outside the measurement loop: it refreshes on a 5-minute ticker, once at startup, and whenever the desired set of destinations changes (after outbound or ICMP target discovery updates). The measurement/send path now usesDNSCache.LookupDeliveryUDPAddr, which never performsLookupHostfor hostnames—it only returns an address if the cache is already populated and still valid; literal public IPs are still resolved synchronously with the existingValidateScope()checks.sendCompositeOffsetsusesdeliveryDNS.Lookupinstead ofdnsCache.Resolve, so slow or timing DNS no longer runs inside the RTT/measurement cycle. If a hostname is not ready yet, that target is skipped for that cycle with a warning log.Explain why the change is necessary
Due to: geolocation: move geoprobe-agent DNS lookups out of measurement loop #3544
Is there supporting documentation or external resources that explain the change? No
Is a CHANGELOG.md update needed? No
Testing Verification
go testoncontrolplane/telemetry/internal/geoprobeforDNSCache_*,DeliveryDNS_*, andLookupDelivery*tests: pass (covers startup refresh, coalesced refresh afterSetDesiredHostPorts, literal-IP lookup without waiting, domain miss before refresh, cache hit/miss/TTL, private IP rejection, invalidhost:port).GOOS=linux go build ./controlplane/telemetry/cmd/geoprobe-agent/: succeeds (agent is//go:build linux).go test ./controlplane/telemetry/cmd/geoprobe-agent/...may fail on macOS because main_test.go is not tagged linux while main.go is—run agent package tests on Linux / CI for a full green check.