Skip to content

Expose final retry counters in JSON totals - #801

Merged
fcostaoliveira merged 3 commits into
masterfrom
codex/fix646-json-retry-counters-20261023
Oct 23, 2026
Merged

fcostaoliveira merged 3 commits into
masterfrom
codex/fix646-json-retry-counters-20261023

Conversation

@fcostaoliveira

@fcostaoliveira fcostaoliveira commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

With --retry-on-error, final JSON omits logical errors and retry activity even though progress output and Prometheus expose those counters. A run whose six requests all exhaust two retries reports Count6 and zero connection errors without showing its six logical failures or twelve retries.

Root cause

The JSON writer has no retry payload. run_stats::summarize() also omits the three per-run counters, so aggregating into fresh storage loses them even though client merges already sum them correctly.

Fix

Preserve retry counters when summarizing and expose unsigned integer Errors, Retry Attempts, and Retried Ops under JSON Totals when retry handling is enabled, including zero values. Command rows do not repeat unattributed global counts. Retry-disabled output keeps its existing field set. Per-run and selected BEST/WORST sections retain actual counts; aggregate sections use the existing rounded, nonzero-preserving mean over actual reported run objects.

The counters expose existing retry accounting: attempts mean queued retries, which may be canceled before a physical resend, and retried operations count logical requests queued at least once. Request completion, error handling, exit status, text tables and metric schemas are unchanged.

Tests

  • New summary/merge/aggregate unit controls fail nine assertions against unchanged production, then pass with the fix. All17 units pass after composing with master cd43101.
  • All three new JSON test functions fail on unchanged master d362619 because Errors is missing. They pass on the final build: two threads/two clients, recovery/exhaustion/zero controls, mixed arbitrary commands in grouped and per-line output, retry-disabled shape, per-run/BEST/WORST/aggregate output, and interrupted5-run series with only2 reported run objects.
  • Five RLTest functions pass on private authenticated Redis: the three new functions plus existing dropped-replay and deadline-drain tests extended to compare JSON errors with failed-key rows. The drain test covers its four modes. No port6379 use.
  • Measured logical error / queued retry / retried-operation counts: recovery0/6/6; exhaustion6/12/6; mixed arbitrary3/9/6. Two-run counts0/3/3 and3/6/3 produce rounded means2/5/3. Before the fix all three fields are absent. These are accounting results, not throughput measurements; no performance-rate improvement is claimed.
  • Final CI and seven independent adversarial reviews remain pending.

Affected versions

Retry counters were introduced by 08cfc24ac3a056fadbaac7a225ed260aee8f6431 (#381) without final JSON exposure. git tag --contains identifies 2.4.0 through2.5.2, plus master. This release range is history-derived; actual baseline reproduction used d362619, and the final implementation is composed with cd43101.

Fixes #646.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

🤖 Automated first-pass review — a human maintainer's review is still required before merge.

Thanks for this. Went through it, and it looks good to me. The new keys only appear in Totals and only with --retry-on-error, so retry-disabled output is unchanged and existing consumers aren't affected. The summarize() change fixes the real root cause, the counters are lost in the fresh-storage aggregate path, rather than just patching the JSON writer. The tests also meet the bar from #364: unit and JSON controls that fail on the old code and pass with the fix, including the interrupted series where the mean has to use the run objects actually reported rather than the configured --run-count.

One question, since JSON keys are hard to rename once they ship: did you consider a more specific name than plain Errors, e.g. something retry-scoped? It sits right next to Connection Errors in the same object, and someone reading the JSON without the README could take it to mean all errors in the run. I guess matching the progress/Prometheus "errors" wording is a fair argument for keeping it, so I won't push if that was deliberate.

Nitpicking: the merge commit from master in the branch history should go away if this is squash-merged.

Otherwise this looks ready to me once CI is green.

@fcostaoliveira

Copy link
Copy Markdown
Collaborator Author

The name is deliberate: this exposes the existing logical-error counter used by progress output and Prometheus. It includes terminal non-retryable error replies as well as retry exhaustion and abandoned replays, so “Retry Errors” could imply the narrower count of failed resends. “Connection Errors” remains the distinct connection-event counter. README documents that boundary, and the fields are emitted only with retry handling enabled so ordinary JSON keeps its existing shape. No request completion or exit-code semantics change.

This PR will be squash-merged after all seven independent reviews and the final CI/bot gates pass, so the integration merge commit will not appear separately in master history.

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.

JSON output has no errors / retry_attempts / retried_ops counters for --retry-on-error runs

1 participant