Skip to content

discovery/dns: add DNS service discovery (dns_sd_configs) - #43

Draft
bwplotka wants to merge 2 commits into
bwplotka/discoveryfrom
bwplotka/discovery-dns
Draft

bwplotka wants to merge 2 commits into
bwplotka/discoveryfrom
bwplotka/discovery-dns

Conversation

@bwplotka

@bwplotka bwplotka commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Adds dns_sd_configs schema validation, /etc/resolv.conf search path and ndots resolution, record-to-TargetGroup mapping (SRV, A, AAAA, MX, NS), and an async UDP/EDNS0 + TCP fallback DNS wire resolver under feature = "discovery". Part of prometheus/scrape.rs#36.

Stack:

  1. discovery: add TargetGroup, StaticConfig, and Prometheus duration helpers #39 discovery: add TargetGroup, StaticConfig, and Prometheus duration helpers
  2. discovery/dns: add DNS service discovery (dns_sd_configs) #43 discovery/dns: add DNS service discovery (dns_sd_configs) (this PR)
  3. http_config: add Prometheus HTTPClientConfig and reqwest client builder #44 http_config: add Prometheus HTTPClientConfig and reqwest client builder
  4. discovery/kubernetes: add pod service discovery (role: pod) #45 discovery/kubernetes: add pod service discovery (role: pod)

Commits in reading order:

  1. cfd22c8: discovery/dns: add DnsSdConfig, ResolvConf, and target group mapping
  2. 809d4d9: discovery/dns: add async UDP/EDNS0 and TCP wire resolver
Intentional differences from Go
  • DnsDiscovery implements a minimal RFC 1035 and RFC 6891 EDNS0 UDP/TCP wire codec directly over tokio::net::{UdpSocket, TcpStream} instead of adding an external DNS dependency equivalent to miekg/dns in discovery/dns/dns.go#L27 and discovery/dns/dns.go#L292. Futures require no Send bounds and run on !Send tokio::task::LocalSet executors.
  • DnsDiscovery::discover executes one discovery poll cycle returning Result<Vec<TargetGroup>, DiscoveryError> rather than spawning an internal refresh loop as in discovery/dns/dns.go#L121, leaving scheduling to the caller.

Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Signed-off-by: Bartek Plotka <bwplotka@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant