Open
Conversation
prateek
reviewed
Oct 27, 2023
| s.reportChanges(counters, gauges) | ||
| s.cachedReporter.Flush() | ||
| // Reset the changed counters and gauges | ||
| counters = counters[:0] |
Collaborator
There was a problem hiding this comment.
you need to set the elements in the slice to the zero value
Collaborator
There was a problem hiding this comment.
what we talked about -- https://go.dev/play/p/WIRovDFJhE5
prateek
reviewed
Oct 27, 2023
| for { | ||
| select { | ||
| case c := <-s.counterChangeNotifyCh: | ||
| counters = append(counters, c) |
Collaborator
There was a problem hiding this comment.
what happens if c is part of a subscope that's closed before you process it?
Collaborator
Author
There was a problem hiding this comment.
As discussed, this will have the effect of flushing out any pending accumulated metrics which is desirable.
prateek
reviewed
Oct 27, 2023
| separator: sanitizer.Name(opts.Separator), | ||
| timers: make(map[string]*timer), | ||
| root: true, | ||
| counterChangeNotifyCh: make(chan *counter, 1024), |
Collaborator
There was a problem hiding this comment.
hm few thoughts about this channel
- any concerns about blocking once we hit the limit?
- how did you arrive at this size?
- maybe this should be configurable too? (akin to https://github.com/uber-go/tally/blob/master/m3/reporter.go#L160 for eg)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PoC purposes only
Only applies to counters and gauges at the moment (not histograms)