Skip to content
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

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

ecordell
Copy link
Contributor

instead of making it a global

@github-actions github-actions bot added the area/CLI Affects the command line label Mar 16, 2022
@jzelinskie
Copy link
Member

This might be a good place for sync.Once

Comment on lines +373 to +376
promOnce.Do(func() {
grpcprom.EnableHandlingTimeHistogram(grpcprom.WithHistogramBuckets(
[]float64{.006, .010, .018, .024, .032, .042, .056, .075, .100, .178, .316, .562, 1.000},
))
})
Copy link
Member

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.


var promOnce sync.Once

// enableGRPCHistogram protects prom metric registration with a sync.Once.
Copy link
Member

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
Copy link
Member

@josephschorr josephschorr left a comment

Choose a reason for hiding this comment

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

LGTM

@ecordell ecordell enabled auto-merge March 16, 2022 12:42
@ecordell ecordell merged commit 051939b into authzed:main Mar 16, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/CLI Affects the command line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants