Skip to content

Conversation

@shaan420
Copy link
Collaborator

PoC purposes only
Only applies to counters and gauges at the moment (not histograms)

s.reportChanges(counters, gauges)
s.cachedReporter.Flush()
// Reset the changed counters and gauges
counters = counters[:0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to set the elements in the slice to the zero value

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what we talked about -- https://go.dev/play/p/WIRovDFJhE5

for {
select {
case c := <-s.counterChangeNotifyCh:
counters = append(counters, c)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if c is part of a subscope that's closed before you process it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, this will have the effect of flushing out any pending accumulated metrics which is desirable.

separator: sanitizer.Name(opts.Separator),
timers: make(map[string]*timer),
root: true,
counterChangeNotifyCh: make(chan *counter, 1024),
Copy link
Collaborator

@prateek prateek Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm few thoughts about this channel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants