Closed bradmalloy closed 6 years ago
Ah, I see. My understanding was that users created individual instances of Timer()
, which would mean that you can track multiple times at once. Would that work? I'm not opposed either way.
The way I've used Timer
in the past which I think is typical is that i'll create 1 Timer
per kind of operation my app does. For example, if I'm developing a web service backend I would have 1 Timer
for each unique API endpoint. Since there can be many concurrent operations on an endpoint at a time, I think following the dropwizard approach would work good because you could still encapsulate the timing logic in one place (which I think is the main goal of your PR) while being able to time multiple events at a time.
This is superseded by #58
Previously, timers in this library required that you time on your own and simply recorded an integer to the histogram. This update adds actual timers called with time() and stop() that add to the meter and histogram of the timer class.