Skip to content

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

Description

@minghanc

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions