client_rust icon indicating copy to clipboard operation
client_rust copied to clipboard

HistogramTimer API

Open adamchalmers opened this issue 3 years ago • 2 comments

Hi! My team at work is converting some of our projects over from docs.rs/prometheus to this crate. One nice-to-have feature we miss from the old crate is the HistogramTimer type. I suggest adding it into this crate for two reasons:

  1. It's convenient for working with histograms and less error-prone than tracking time manually (using HistogramTimer means you don't have to check every possible early return/drop point yourself)
  2. It would simplify the process of porting code from docs.rs/prometheus over to this crate.

Happy to implement this myself.

adamchalmers avatar Sep 30 '22 14:09 adamchalmers

I am in favor of this. Given that Histogram is Clone, Send and Sync, I don't think this change will be intrusive.

Happy to implement this myself.

Great. Thank you. Let me know in case you need any help.

mxinden avatar Oct 04 '22 11:10 mxinden

Referencing https://github.com/nox/prometools/blob/main/src/histogram.rs by @nox here.

Again, I am in favor of supporting this natively.

mxinden avatar Jan 02 '23 08:01 mxinden