metrics-rs / metrics

A metrics ecosystem for Rust.
MIT License
1.08k stars 148 forks source link

Support serializing and deserializing `metrics_util::Summary` #410

Open seekstar opened 9 months ago

seekstar commented 9 months ago

I use metrics_util::Summary to measure quantiles of latencies. The latency files are too large, so I usually only save the calculated quantiles (0.1, 0.2, ..., 0.9, 0.99, 0.999, etc). However, the problem is that sometimes I want to know latencies at other quantiles (e.g., 0.91, 0.92, ..., 0.98), but the original latency files are not saved. This problem can be solved perfectly if metrics_util::Summary can be serialized and deserialized, so that I can save the metrics_util::Summary instead of large latency files.

tobz commented 9 months ago

It seems like this should be technically possible: sketches-ddsketch supports implementing Serialize/Deserialize for DDSketch, gated behind a feature flag. We could do the same thing -- expose an optional feature flag -- which would in turn activate the feature flag in sketches-ddsketch.

Not sure when I'll be able to get to this, though.