HdrHistogram / HdrHistogram/HdrHistogram_rust

iter_recorded() method fails to iterate if all the values are zero.

Open
#92 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
372
Forks
50
PR merge metrics
No merged PRs in 30d

Description

iter_recorded() won't work when all the values recorded by the Histogram instance is 0.
Sample code to hit the issue:

let mut tracker = Histogram::<u64>::new(3).unwrap();
tracker += 0;
tracker += 0;
tracker += 0;

 // print 3 as expected.
 println!("{}", tracker.len());

 let mut res = String::new();
 for v in tracker.iter_recorded() {
     res.push_str(format!("value {} and count {}", v.value_iterated_to(), v.count_at_value()).as_str());
 }

 // nothing is printed. Expected: value 0 and count 3
 println!("{}", res);

We use the iterator to print out a certain format and emit to our log file. Is there a better way to do that for the logging purpose?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the iter_recorded() entry point and reproduce the provided Histogram example with three zero values. Trace why the iterator emits nothing, then verify that the completed behavior reports value 0 with count 3 and preserves iteration for other recorded values.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.