-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When using a counter group or gauge group, the initialization of the time series happens on first use. However, if two different goroutines tried to access the same set of labels concurrently, there was a rare race where one goroutine could try to increment the time series state before the other goroutine had finished initializing the data structure. Fix this by waiting for the initialization to complete before returning the counter on a call to .With(). This wait is cheap and involves only a single atomic load in the fast path after initialization has completed. Thanks Dan Upton and Neal Lathia for the report. Fixes #977
- Loading branch information
Showing
3 changed files
with
15 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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