tikv / rust-prometheus

Prometheus instrumentation library for Rust applications
Apache License 2.0
1.07k stars 184 forks source link

Add a Cargo optional feature to replace `std::time::Instant` with `tikv/minstant::Instant` #512

Open eval-exec opened 9 months ago

eval-exec commented 9 months ago

Is your feature request related to a problem? Please describe. minstant is drop-in replacement for std::time::Instant that measures time with high performance and high accuracy powered by TSC.

Describe the solution you'd like Add a cargo feature "minstant" to https://github.com/tikv/rust-prometheus/blob/f49c724df0e123520554664436da68e555593af0/Cargo.toml#L17-L22

Describe alternatives you've considered

Additional context In my project, I am using the Histogram module and noticed that it relies on std::time::Instant for time measurement: https://github.com/tikv/rust-prometheus/blob/f49c724df0e123520554664436da68e555593af0/src/histogram.rs#L517-L523

Adding the optional minstant feature to rust-prometheus would be beneficial.

eval-exec commented 9 months ago

Hello, if you think it's a good idea, I would like to open a pull request.