-
Notifications
You must be signed in to change notification settings - Fork 246
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
protect prom metric registration with a lock #480
Conversation
This might be a good place for sync.Once |
promOnce.Do(func() { | ||
grpcprom.EnableHandlingTimeHistogram(grpcprom.WithHistogramBuckets( | ||
[]float64{.006, .010, .018, .024, .032, .042, .056, .075, .100, .178, .316, .562, 1.000}, | ||
)) | ||
}) |
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.
I think it's more confusing to not just inline this, rather than putting it in a function.
pkg/cmd/server/server.go
Outdated
|
||
var promOnce sync.Once | ||
|
||
// enableGRPCHistogram protects prom metric registration with a sync.Once. |
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.
I'd say something like: enableGRPCHistogram
enables the standard time history for gRPC requests, ensuring that it is only enabled once
instead of making it a global
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.
LGTM
instead of making it a global