Repository navigation
fix(prober): classify a probe deadline by the request phase it interrupted - #1264
Merged
Merged
Conversation
…upted A mesh_dns probe whose lookup was still in flight at the 2 s deadline was counted `timeout`, never `dns_timeout`. net/http's Transport.getConn dials on context.WithoutCancel(req.Context()) and, when the request context ends first, returns context.Cause of the request context (go1.27.1 src/net/http/transport.go:1596/1651), so the error carries no *net.DNSError and classifyErr cannot see the resolution stall. TestTransportHidesResolutionStall pins that stdlib behaviour. Every probe now carries an httptrace.ClientTrace (GetConn, DNS, Connect, TLS, GotConn with Reused, WroteRequest, GotFirstResponseByte) recorded under a mutex, since the dial goroutine keeps firing hooks after Do returns. classifyFailure turns a deadline in the dns phase into dns_timeout; every later phase stays `timeout`. The result label set is unchanged (no connect_timeout etc.): the phase and per-phase milliseconds go on the AETHER_PROBE_FAIL line (phase, reused, conn_ms, dns_ms, connect_ms, tls_ms, write_ms, ttfb_ms; -1 = never started). No per-phase histogram: it would multiply series by phase for a signal the bounded log line already carries. Docs: runbook field reference and timeout vs dns_timeout note, soak README attribution, configuration.md, mesh-dns-alerts.yml comment. Closes #1252 Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.
Closes #1252
Problem
A mesh_dns probe whose name lookup was still in flight when its 2 s deadline fired was counted
timeout, neverdns_timeout. So "dns_* is zero" did not mean DNS was healthy, and atimeoutdid not say which phase ran out. #1240 had to infer the phase from access-log source-port order.Root cause, checked against the pinned SDK (go1.27.1):
Transport.getConndials oncontext.WithCancel(context.WithoutCancel(ctx))(src/net/http/transport.go:1596). When the request context ends first, it returnscontext.Cause(treq.ctx)(:1651), a barecontext deadline exceededwith no*net.DNSErrorin the chain.TestTransportHidesResolutionStallpins this. It fails if a future Go starts surfacing the DNSError.Fix
httptrace.ClientTrace(GetConn, DNSStart/Done, ConnectStart/Done, TLSHandshakeStart/Done, GotConn withReused, WroteRequest, GotFirstResponseByte). The dial goroutine keeps firing hooks afterDoreturns, sophaseRecorderkeeps everything under a mutex and the probe reads only a copied snapshot.classifyFailure=classifyErr+ phase: a deadline in thednsphase becomesdns_timeout. A deadline in any later phase staystimeout.AETHER_PROBE_FAILline gains stable keysphase, reused, conn_ms, dns_ms, connect_ms, tls_ms, write_ms, ttfb_ms(-1= the phase never started; the phase the probe ended in is measured up to the failure).phaseis one ofdns|connect|tls|write|first_byte|headers|conn_wait|response|"".net/http/httptracewas added.Metric contract
aether_probe_requests_total{tier,target,result}: the name is unchanged and the result value set is unchanged (success, http_error, connection_error, timeout, saturated, dns_error, dns_nxdomain, dns_timeout). I did not addconnect_timeout/first_byte_timeout. Each new value would be a new series per tier×target×pod. Splittingtimeoutwould also silently change what existingresult="timeout"rules match. The log line carries the phase instead.timeouttodns_timeout.Example line
Tests
main. They were red:TestProbePhaseDNSStall: results = map[timeout:1], want exactly {dns_timeout:1}. That proves the old misclassification end to end throughprobe().phase_test.gocovers each case throughprobe():dns_timeout/dnstimeout/first_byteDialer.ControlContextholds connect(2)):timeout/connectfirst_byte,reused:true, dns/connect-1http_error:responseconnection_error/connectphase_recorder_test.gohas a concurrent-hooks test (for--config=race), a phase-ordering table, the timing math, and aclassifyFailuretable.bazel test //prober/...: pass.bazel test --config=race //prober/internal/prober:prober_test --runs_per_test=10: pass.bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //...: pass.make format-check: clean.make gazelle: applied.Consumers updated
docs/runbook.md: field reference, an updated example line, and atimeoutvsdns_timeoutnote.e2e/soak/README.md: attribution and grading notes.docs/configuration.mddocs/observability/mesh-dns-alerts.yml: comment only.MeshDNSResolutionFailingalready matchesdns_error|dns_nxdomain|dns_timeout|timeout, so it fires exactly as before.No
charts/file changed, so there is no chart bump. The prober chart pins the image digest at package time.For external alert-rule owners (GitOps repo)
success, http_error, connection_error, timeout, saturated, dns_error, dns_nxdomain, dns_timeout. The set is unchanged.{tier="mesh_dns",result="timeout"}alone will see resolution stalls disappear from it. They now count underdns_timeout.result=~"dns_.*"orresult="dns_timeout"will start firing on stalls it could never see before.result="success"/ total).🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr