Skip to content

feat(mesh-dns): split nodata from answered and bucket the query type - #598

Merged
bpalermo merged 1 commit into
mainfrom
feat/mesh-dns-qtype-nodata-split
Jul 26, 2026
Merged

bpalermo merged 1 commit into
mainfrom
feat/mesh-dns-qtype-nodata-split

Conversation

@bpalermo

Copy link
Copy Markdown
Owner

Follows #586, completes the deferred qtype/nodata split. #596 already delivered the other half of that item (the proto attribute + aether.mesh_dns.responses_truncated_total); this is the rest. Metrics-only.

1. nodata split out of answered

serveMesh recorded answered for BOTH a real A hit and the NODATA reply a known mesh name gets for a non-A type (AAAA → NOERROR + empty answer, deliberate so the name consistently EXISTS for c-ares). Those are operationally different: a healthy mesh shows a steady NODATA trickle from the AAAA half of every dual-stack lookup, so conflated, a rise in NODATA against real hits — clients failing over to IPv6, or a record table that stopped producing usable A records — is invisible.

The reply is byte-for-byte unchanged; only the metric result differs. An A query whose stored record is not a parseable IPv4 also lands in nodata, which is the point: a record-table defect showing up as unexpected nodata on qtype="a" is exactly the signal wanted.

NODATA still counts as an answer for last_answered_timestamp_seconds — it is an authoritative reply derived from the record table, produced by a handler that ran end to end (so watchdog/staleness semantics are unchanged).

2. Bucketed qtype attribute

Cardinality was the whole risk, so the value set is closed. DNS defines ~90 query types and the CNI DNATs every managed pod's :53 straight at this resolver, so untrusted queries genuinely reach it and a raw qtype would let any pod on the node inflate the counter's series count at will. queryQType maps into a fixed set and everything unrecognised collapses to other:

bucket why it earns its own series
a the only type the record table can answer — the hit path itself
aaaa every dual-stack resolver (glibc getaddrinfo, c-ares, Go) fires it next to A; it is essentially the whole nodata trickle, and the IPv6-failover signal
https curl 8.x / browsers / systemd-resolved query the HTTPS RR (65) alongside A+AAAA; high-volume and routine, so leaving it in other would bury the genuinely exotic queries other exists to expose
srv headless Services and gRPC-style discovery; always forwarded, so it is the forward path's main non-address type
ptr reverse lookups from tooling/logging; a burst is a classic accidental source of upstream latency
txt forwarded, normally ~zero, and both a probe and an exfil channel — cheap to keep separable
cname what debugging tools (dig CNAME) and some client libraries ask directly; separates an operator/tool pattern from workload traffic
other everything else, including a message without exactly one question

Worst case is bounded at 8 qtype x 6 result x 2 proto = 96 series per node, no matter what is asked; in practice only a handful are ever non-zero.

qtype is NOT added to the duration histogram. Its 15 explicit buckets make every extra dimension expensive (proto would double it, qtype would multiply it by eight), and neither buys anything: latency here is decided by the PATH taken, which result already names. A mesh hit and an AAAA NODATA do the same map lookup under the same lock; a forwarded SRV costs the same kube-dns round trip as a forwarded A. qtype/proto answer "what is being asked, over what" — a counter question.

Not changed

EDNS0 OPT echo, NODATA-for-non-A, authoritative never-forward-the-mesh-zone, SO_REUSEPORT, the #596 self-check watchdog and TCP-forward logic, the snapshot envelope/heartbeat. No chart change, so no Chart.yaml bump.

Verification

Slim dep graph re-proven — both somepath queries from //agent/cmd/mesh-dns:mesh-dns are empty:

$ bazel query 'somepath(//agent/cmd/mesh-dns:mesh-dns, @io_k8s_sigs_controller_runtime//...)'
INFO: Empty results
$ bazel query 'somepath(//agent/cmd/mesh-dns:mesh-dns, @com_github_envoyproxy_go_control_plane//...)'
INFO: Empty results
  • bazel build //agent/... //charts/... green; bazel test //agent/... 28/28 pass
  • bazel build --config=ci //agent/... green (gocognit)
  • bazel run //:format + make format-check clean; BUILD.bazel via make gazelle (no new external deps)

New metrics_test.go drives the real handler through a manual OTel reader and asserts on the attributes actually exported: A hit → answered/qtype=a; AAAA on a known name → nodata/qtype=aaaa; NAPTR/ANY/CAA/61234 all collapse to a single other series; proto still splits udp vs tcp; miss/cold results keep their qtype; plus a table pinning the closed bucket set.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR

Completes the deferred qtype/nodata half of the mesh-DNS query-metric
breakdown. #596 already gave aether.mesh_dns.queries its proto attribute and
the responses_truncated_total counter; this is the rest.

The `answered` result conflated two operationally different things: a real A
hit, and the NODATA reply a known mesh name gets for a non-A type (AAAA), which
exists so the name consistently EXISTS for c-ares. A healthy mesh shows a
steady NODATA trickle from the AAAA half of every dual-stack lookup, so
conflated, NODATA rising against real hits — clients failing over to IPv6, or a
record table that stopped producing usable A records — is invisible. They are
now separate result values. NODATA still counts as an answer for
last_answered_timestamp_seconds: it is an authoritative reply produced from the
record table by a handler that ran end to end.

The new qtype attribute is BUCKETED, never raw. DNS defines ~90 query types and
the CNI DNATs every managed pod's :53 straight at this resolver, so an
arbitrary client could otherwise inflate the counter's series count at will.
Everything unrecognised collapses to `other`, bounding the counter at
8 qtype x 6 result x 2 proto = 96 series per node. qtype is deliberately NOT
added to the duration histogram: 15 explicit buckets make each extra dimension
expensive, and latency here is decided by the path taken — which `result`
already names — not by the type asked for.

Metrics-only: no resolver semantics change (EDNS0 echo, NODATA-for-non-A,
never-forward-the-mesh-zone, SO_REUSEPORT, the self-check watchdog, TCP
forwarding and the snapshot envelope are all untouched).

Follows #586.

Co-Authored-By: Claude <[email protected]>
Claude-Session: https://claude.ai/code/session_01EioJVuoepwStjHoRLB52WR
@bpalermo
bpalermo merged commit de8b6f4 into main Jul 26, 2026
15 checks passed
@bpalermo
bpalermo deleted the feat/mesh-dns-qtype-nodata-split branch July 26, 2026 15:02
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