Repository navigation
fix(soak): classify k6 failures by HTTP status, and attribute the residual (#887) - #915
Merged
Merged
Conversation
…idual (#887) The k6 soak's failure classifier could not increment `http_4xx` or `http_5xx` at all. Its status tests sat inside an `error_code === 0` branch, and k6 sets a NON-ZERO error_code for an HTTP error response -- verified on k6 v2.3.0, a 404 arrives as 1404, a 503 as 1503, a 504 as 1504, i.e. 1000 + status. Every 4xx therefore fell through to the 1400-1499 range test and was filed as `proto`; every 5xx fell off the end into `other`. That is where the last two soaks' unattributable residual came from. The rev234 run's 33 `other` failures reconcile 33-of-33 against the source proxies' access logs in VictoriaLogs as plain 504/UT responses, 31 on main-worker-01 and 2 on main-worker-03, matching the two runners that reported 31 and 2. They were never mysterious; they were misfiled. classify() now tests status first: a response carrying an HTTP status was received, and whatever error_code k6 derived from it restates the status rather than adding information. That also resolves a real ambiguity in k6's numbering, where 1400-1499 means both "HTTP/2 protocol error" and "1000 + a 4xx status" -- a genuine HTTP/2 error leaves status at 0, so only it can now reach the `proto` test. The 1500-1599 range is handled explicitly instead of falling to `other`, and `other` keeps its meaning of "genuinely unrecognised". The summary now also breaks every non-zero class down by target and by reason (the exact error_code/status pair), and logs each failure verbatim as AETHER_FAIL with a timestamp -- the field that lines a burst up against a specific proxy roll, which is the only way to see #823 given the external prober rides one keep-alive connection (#846). How the breakdown is produced, verified rather than assumed: handleSummary's `data.metrics` carries NO per-tag submetrics, and metrics cannot be created outside the init context, so neither the existing tags nor a counter-per-combination can be read back. A submetric does appear once declared as a threshold, so a small key space (281 submetrics, +5MiB RSS and well under 1% of a core) is declared up front for exact totals, with the bounded verbatim sample covering combinations it cannot enumerate. A second reconciliation line, `attributed=A of classified=N`, reports that case rather than losing it. The AETHER_METRIC marker stays a single machine-parseable line with its existing keys intact; byEndpoint, byReason and attributed are added. No files are written and no remote imports are added. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
bpalermo
enabled auto-merge (squash)
September 23, 2026 10:23
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 #887.
This reframes the issue
#887 asks for detail on an opaque
otherbucket. The residual was not opaque because detail was missing — it was misfiled.classify()tested the HTTP status only inside anerror_code === 0branch. k6 sets a non-zeroerror_codefor an HTTP error response, so those status tests were unreachable for every response they were written for:proto(caught by the 1400–1499 range)http_4xxother(fell off the end)http_5xxhttp_4xxandhttp_5xxcould never be incremented at all. Both counters were dead code from #846 onward, which is why every soak reportedhttp_4xx: 0, http_5xx: 0— a zero that looked like evidence and was not (cf. aether#853, and the new gotcha 10 in the README).The rev234 run's 33
otherfailures were reconciled against the source proxies' access logs in VictoriaLogs: 33 of 33 were plain504/UTresponses, 31 on main-worker-01 and 2 on main-worker-03, matching the two runners that reported 31 and 2 exactly.k6 error-code semantics — verified, not assumed
I did not take
1000 + statuson trust. Measured directly on k6 v2.3.0 against fixed-status local targets:Two consequences beyond the reported bug:
statusat 0, so only it can now reach theprototest.1050, which no range in the function would catch. It is saved only by theres.errorstring test, which is why that test runs first. The existing comment claimed this without a number; it now has one.Which mechanism exposes the tag breakdown — verified
The task asked me to find out whether k6 exposes per-tag submetrics in
handleSummaryrather than guess. Three probes on k6 v2.3.0:data.metricscarries no per-tag submetrics. A counter incremented with{endpoint, code, status}appears as exactly one entry, aggregated across every tag value:new Counter()in a VU throws:count: 0when never hit:So (3) is the mechanism — but it is not free, and I measured before committing to it. ~1,950 declared submetrics cost +28–33MiB RSS and +0.5–2% of a core continuously. Both land on the wrong thing: that CPU is the same order as the fleet-core deltas the profiling passes exist to detect (#673 was closed on −0.070 fleet cores), and the memory eats a container this repo has already OOM-killed mid-soak (see the resources comment in
k6-runner.yaml).Hence a small declared key space (281 submetrics) for exact totals — measured at +5MiB RSS and +0.9s CPU over a 180s/60rps run, mostly one-off startup (the same delta over 60s was +0.65s), so the steady-state share is well under 1% of a core — plus a bounded verbatim
AETHER_FAILsample for the combinations it cannot enumerate. The sample costs nothing in the healthy case, because the healthy case is zero failures, and its timestamps are what line a burst up against a proxy roll.Red-state evidence
k6is installed locally (v2.3.0), so this is a real run, not a synthesiseddataobject. The unmodified production file was driven against local fixed-status targets using k6'shostsoption via--config, so nothing in the script was edited for the test.Targets: svc-1→504, svc-2→404, svc-3→302, svc-4→refused, echo→200, mixed-svc→unresolvable.
Before (
origin/main, same targets, same k6):After:
code=1504 status=504is the rev234 residual's exact fingerprint, now named by the instrument instead of requiring an access-log reconciliation.The per-event lines carry the full tuple:
And the
AETHER_METRICmarker is still one parseable line, with the existing keys untouched:The
timeoutpath, separately exercisedI restructured the branch the timeout test lives in, so I drove it rather than reasoning about it. The only change to the copy under test was adding
timeout: '400ms'to the request (there is no global k6 option for it); svc-1 pointed at a server that always answers 3s late.That is the code no numeric range would have caught, classified correctly by the error string.
The new reconciliation is falsifiable
This change is an instrument, so its own gate must be shown capable of failing.
attributed=A of classified=Nunder-reports when a code/status pair is not in the declared key space. Driving svc-1 to return 599 (not an IANA-registered status, so deliberately undeclared):and the sample line names it verbatim:
{"class":"http_5xx","code":1599,"status":599,...}. The gate fires, and the escape hatch works.Green-state control
All six targets healthy, 30,000 iterations — the instrument does not fabricate:
No
GAP:line, noAETHER_FAILlines.Not covered
tlsandprotowere not driven end-to-end — forcing a genuine TLS handshake failure or an HTTP/2 protocol error against a loopback stub was not worth the fixture. Their range tests are unchanged from #846 apart from now being reachable only whenstatus == 0, which is the intended narrowing.classified=Ncan now exceedhttp_req_failed≈Mwhen 3xx responses are involved, because k6 counts onlystatus >= 400as failed whileclassify()treats a 3xx as a failure. That is pre-existing (the before-run shows 1046 vs 839) and is an artefact of the synthetic 302 target, not a regression.Constraints
AETHER_METRICmarker kept and extended, existing keys intact.bazel build --config=lint --@aspect_rules_lint//lint:fail_on_violation //e2e/soak:soak_shellpasses.README updated: the collection recipe, both reconciliation lines, and a new gotcha 10 on why a zero in a class is only evidence once the class is shown to be reachable.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr