HdrHistogram_rust icon indicating copy to clipboard operation
HdrHistogram_rust copied to clipboard

Allow customizing handling of out-of-range counts when serializing

Open marshallpierce opened this issue 7 years ago • 2 comments

We allow u64 counts, but the serialization format only allows i64::max_value() as the largest count. So, you can end up with an un-serializable histogram.

It would be nice if the user could choose what to do in such a situation. Right now we always error, which means I needed to do things like https://github.com/jonhoo/hdrsample/pull/40/files#diff-c761d465047faa0efb455f492b2f1e07R528 when testing serialization with random counts.

Options that come to mind:

  • Error (we've got this one now)
  • Squish oversized counts down to i64::max_value()
  • ???

marshallpierce avatar Mar 16 '17 19:03 marshallpierce

See also https://github.com/jonhoo/hdrsample/pull/40/files#diff-9f04f5afe722ac18d9cc630373624c02R127

marshallpierce avatar Mar 16 '17 19:03 marshallpierce

One alternative here is that we make Counter an enum, where the variants are u8, u16, u32, and u63...

jonhoo avatar Mar 16 '17 19:03 jonhoo