Repository navigation
Report empty latency histograms consistently in final output - #793
Merged
Merged
Conversation
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.
Problem
An empty arbitrary-command or Totals histogram prints
nanfor its text average and nonzero percentile placeholders. JSON also reports 0.007 ms for percentiles of an empty distribution.Root cause
Final output calls HDR mean/percentile queries without consistently checking histogram sample count. HDR scalar empty-bin values are implementation results, not measured latency.
Fix
Print
---for every empty final text average/percentile row. Keep JSON latency fields and percentile keys, writing numeric zero when the histogram is empty. Preserve rows, encoded HDR distributions, populated values, configured percentile order, and existing live/per-second behavior. Document the empty-output convention.Tests
4bade818): the old empty values include 0.007 ms; fixed values are zero. Cover built-in/arbitrary rows, per-line/per-command breakdown, empty Totals, monitor placeholders, and multi-run averages.Affected versions
The arbitrary-command mean path was introduced by
fdf704b6671393c6b7f3dc5b77941c5bc81abe42(#100), first released in 1.4.0; affected through 2.5.2 and current master before this fix. The monitor placeholder variant dates from1e7877b(#330), first released in 2.3.0. Release range is source-history evidence; this owner pass executes current-base production sources and the fix, not every historical release.Fixes #638
🤖 Generated with Claude Code
Note
Low Risk
Output-formatting only in final stats reporting; no change to benchmarking, connection, or latency recording paths.
Overview
Fixes misleading final benchmark output when a command row has no latency samples (e.g. unused GET in a write-only ratio, arbitrary commands with zero ops, or empty Totals).
Text results now show
---for average latency and all configured percentile columns on those rows instead ofnanor bogus HDR-derived numbers. JSON keeps the same keys but writes 0 for average/min/max and percentile values when the histogram is empty; the compressed HDR payload stays empty.Rendering changes are gated on
hdr_total_countinresult_print_to_json,print_avg_latency_column, andprint_quantile_latency_columns(including arbitrary/aggregated and Totals rows). README documents the text vs JSON convention. Regression tests cover built-in/arbitrary breakdowns, multi-run averages, monitor placeholders, and connection failures (#638).Reviewed by Cursor Bugbot for commit 9ab028c. Bugbot is set up for automated code reviews on this repo. Configure here.