-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop timer/meter #206
Stop timer/meter #206
Conversation
- use map[*StandardMeter]struct{} instead of map[int64]*StandardMeter to avoid id management pitfalls - update documentation and examples
Use set of meters and update documentation
(am in the middle of a bunch of travel and a conference, will try to take a look soon.. leaving the tab open) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Approving with small change in comment
@@ -227,7 +258,7 @@ func (ma *meterArbiter) tick() { | |||
func (ma *meterArbiter) tickMeters() { | |||
ma.RLock() | |||
defer ma.RUnlock() | |||
for _, meter := range ma.meters { | |||
for meter := range ma.meters { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't this syntax only work in newer Go? I would leave it as is to avoid breaking bw compatibility.
Edit: I see tests pass on all the old versions, disregard.
@mihasya thanks! |
based on #197
Stop
to timer.Stop
when metrics are unregistered.meter Stop()
to avoid data races accessing thestopped
flag.meter Mark()
, return if meter is already stopped (without panicking).