HdrHistogram_rust
HdrHistogram_rust copied to clipboard
Allow customizing handling of out-of-range counts when serializing
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()
- ???
See also https://github.com/jonhoo/hdrsample/pull/40/files#diff-9f04f5afe722ac18d9cc630373624c02R127
One alternative here is that we make Counter
an enum
, where the variants are u8
, u16
, u32
, and u63
...