Repository navigation
fix(prober): give the seconds-valued duration histograms explicit seconds buckets (#732) - #733
Merged
Merged
Conversation
…onds buckets (#732) aether_probe_request_duration_seconds records time.Since(start).Seconds() but took the OTel SDK's default explicit boundaries (0, 5, 10, 25 ... 10000), which are tuned for MILLISECONDS. With seconds-valued observations the first bucket is "<= 5 s", so a healthy 2 ms probe and a timed-out 2 s probe are the same bucket: control-tested on talos, all 18,394 pre-fix ~2 s timeout observations on one prober sit in le=5, identical to +Inf, and every derived quantile reads flat. Set explicit seconds boundaries on the instrument (metric.WithExplicitBucketBoundaries, honoured by the pinned otel metric v1.44 -- no View needed), chosen so healthy sub-10 ms probes, the 1 s resolver retransmit (#728), the 2 s probe budget and the 5 s legacy retransmit each land in their own bucket. Name and unit are unchanged. Swept every histogram in the repo for the same mistake and fixed the three others that recorded seconds into the millisecond defaults: aether.agent.snapshot.duration, aether.agent.liveness.promotion_delay_seconds, aether.registrar.sync.duration and aether.replicator.sync.duration. mesh-DNS, the supervisor and the CNI plugin already carried explicit boundaries. The prober test asserts the boundaries on the EXPORTED data point via an sdkmetric ManualReader, so it covers the option actually reaching the SDK, and pins that a 2.0 s observation lands in le=2 and not in le=1.5. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
added a commit
that referenced
this pull request
Sep 6, 2026
…roven serving (#729) (#734) On an `aether-mesh-dns` roll (maxSurge:1/maxUnavailable:0, SO_REUSEPORT, readiness initialDelaySeconds:1, no preStop, no drain) the DaemonSet controller deletes the predecessor the instant the successor passes its first readiness probe, and `Server.Start` closed the UDP+TCP sockets on the resulting SIGTERM. Every datagram the kernel had already steered into the departing socket's queue was discarded. #726 Phase 1 traced a 5.106 s hole in the mesh-domain access log to exactly one such lost query: Go's resolver singleflights by name, so one drop stalls every concurrent lookup of that name for a full retransmit timeout. #728 shrank that to ~1 s from the client side; the datagram loss was untouched. Lame duck. On SIGTERM the resolver now removes its ready marker (the pod reports NotReady, which is honest — it IS leaving) and KEEPS SERVING until either a successor is observed answering on the same address or `--lame-duck-max` (default 10s) elapses; only then does it close and exit 0. Successor detection is evidence, not a timer. The resolver answers a reserved identity name, `_instance._aether.<mesh-domain>` TXT, with 64 random bits minted at process start — random, because predecessor and successor are each pid 1 in their own container, so a pid stamp could never tell them apart. The lame duck queries that name OVER THE WIRE at its own listen address every 200 ms. Both processes hold a socket in the reuseport group, so the kernel hashes each probe (fresh source port, fresh hash) at one of them; a reply carrying someone else's stamp proves both halves of what must be true before closing — the successor is IN the group and it ANSWERS. Our own stamp, or no reply, is "not yet". A second SIGTERM cuts the window short (reason=signal); the handler is registered only after the shutdown begins, so the first signal can never be mistaken for it. Residual, stated in the code and unfixable from userspace: close() on a reuseport socket can still discard a datagram queued between the last recvfrom and the close. eBPF sk_reuseport steering would be the complete fix. This narrows the exposure from every roll to that instant. Metrics: aether.mesh_dns.lame_duck.exits{reason=successor|deadline|signal} and aether.mesh_dns.lame_duck.duration (seconds, EXPLICIT seconds buckets — the mistake #732/#733 just swept out of the repo). The histogram builder now requires boundaries rather than defaulting, so the next instrument cannot repeat it. INFO lines: "lame duck started", "successor observed" (both stamps), "lame duck deadline reached", "listener closed". Chart 0.92.7 -> 0.92.8: `agent.meshDnsDaemon.lameDuckMax` (default "10s") and a terminationGracePeriodSeconds DERIVED from it (+5s) so the kubelet can never SIGKILL mid-window; no preStop, since the process handles SIGTERM itself. maxSurge:1/maxUnavailable:0 unchanged. Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr Co-authored-by: Claude Fable 5.1 <[email protected]>
This was referenced Sep 6, 2026
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.
Fixes #732.
The bug
prober/internal/proberrecordstime.Since(start).Seconds()intoaether_probe_request_duration_secondsbut created the instrument with no boundaries, soit inherited the OTel SDK's defaults —
0, 5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10000— which are tuned for values expressed in milliseconds.Against a seconds-valued duration the first bucket is
le="5"seconds: a healthy 2 msprobe and a timed-out 2 s probe are indistinguishable. Control-tested on talos during the
#728 validation: all 18,394 pre-fix ~2 s
timeoutobservations on one prober sit inle=5, identical to+Inf.Mechanism used: the instrument option, not a View
metric.WithExplicitBucketBoundarieshas been an instrument option since otel metricv1.20 and the repo pins
go.opentelemetry.io/otel/metric v1.44.0/go.opentelemetry.io/otel/sdk/metric v1.44.0, so the option is honoured directly by theSDK — no
sdkmetric.NewViewis needed (and none exists anywhere in the repo today; themesh-DNS resolver already uses the instrument option the same way). The new test asserts
against the exported data point through an
sdkmetric.ManualReader, so it proves theoption actually reaches the SDK rather than just checking a package variable.
Boundaries chosen so the four regimes that matter are each separated:
healthy sub-10 ms probes · the 1 s resolver retransmit (#728) · the 2 s probe budget
(
Config.Timeout) · the 5 s legacy resolver retransmit. Metric name and unit ("s")are unchanged.
Sweep: every histogram instrument in the repo
grep -rn 'Float64Histogram\|Int64Histogram' --include='*.go' agent/ common/ registrar/ controller/ prober/ registry/ cni/aether_probe_request_duration_secondsprober/internal/prober/prober.gotime.Since().Seconds())aether.agent.snapshot.duration(units)agent/internal/xds/cache/cachemetrics/cachemetrics.goaether.agent.liveness.promotion_delay_secondsagent/internal/cni/server/metrics.goaether.registrar.sync.duration(units)registrar/internal/server/metrics.goaether.replicator.sync.duration(units)registrar/internal/replicator/metrics.goaether.mesh_dns.query.duration(units)agent/internal/meshdns/metrics.goqueryDurationBuckets0.0001 … 5aether.supervisor.handoff.duration(units)agent/internal/proxy/hotrestart/metrics.go1, 5, 10, 30, 60, 120, 300aether.supervisor.drain.duration(units)agent/internal/proxy/hotrestart/metrics.go1, 5, 10, 30, 60, 120aether.cni.operation.duration(units)cni/internal/telemetry/operations.go0.05 … 10No
Int64Histogramexists anywhere in the repo;controller/andregistry/register nohistograms at all.
Note the OTLP→Prometheus exporter appends the unit suffix, so the dot-named instruments
above all land in Prometheus as
*_duration_seconds— the same trap, same fix.Dashboards / hard-coded bucket labels
levalue for any of these metrics. The onlyprober references are counter queries (
aether_probe_requests_total) ine2e/soak/README.md,e2e/pressure/run.shanddocs/observability/mesh-dns-alerts.yml— unaffected.
docs/proposals/013_mesh-availability-prober.mdis updated to record theexplicit boundaries as part of the metric's contract.
k8s-talos-main, read-only from here):grep -rn aether_probe_request_durationreturns nothing — no Grafana panel or alert rule consumes the prober histogram today,
so no
lelabel changes are required there. The onlyle-bearing aether rule isMeshDNSAuthoritativeSlowinclusters/talos-main/prometheus/values.yaml:481(
histogram_quantile(0.99, sum by (le, node)(rate(aether_mesh_dns_query_duration_seconds_bucket{result="answered"}[10m]))) > 0.15)— it reads the mesh-DNS histogram, whose buckets are unchanged by this PR, so the 150 ms
threshold keeps its meaning. Whoever adds prober latency panels should now be able to,
which was the point.
Validation
bazel test --test_arg=-test.short //prober/... //common/... //agent/internal/meshdns/...— passbazel test --test_arg=-test.short //agent/internal/xds/cache/... //agent/internal/cni/... //registrar/... //cni/...— pass (every touched package)make gazelle,make format-check— clean. No dependency changes.charts/change: the prober chart is version-stamped per commit.After deploying the prober chart, this should read in milliseconds, not
0or5:and the timeout tail should now be visible as its own bucket rather than folded into
le=5:🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr