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

metrics: Enforce smaller set of method labels #4545

Merged

Conversation

hairyhenderson
Copy link
Collaborator

Protects against unbounded cardinality on the method label.

Note: I'm finding myself copying code again between the two metrics endpoints - how do we feel about internal/? I ask because there's no use of it yet... Otherwise I think I'd rather throw the common code in an internal/metrics package or something like that...

Signed-off-by: Dave Henderson [email protected]

@hairyhenderson hairyhenderson self-assigned this Jan 23, 2022
@francislavoie francislavoie added bug 🐞 Something isn't working under review 🧐 Review is pending before merging labels Jan 23, 2022
@francislavoie francislavoie added this to the v2.5.0 milestone Jan 23, 2022
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Awesome, thanks Dave! Just a couple things

modules/caddyhttp/metrics.go Outdated Show resolved Hide resolved
modules/caddyhttp/metrics.go Outdated Show resolved Hide resolved
@hairyhenderson
Copy link
Collaborator Author

@mholt I've merged the common sanitize functions into an internal package - PTAL!

Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Thanks Dave! LGTM except one question I had. I might just not be understanding it fully but I am curious your thoughts. Really appreciate it!

internal/metrics/metrics.go Show resolved Hide resolved
@mholt mholt removed the under review 🧐 Review is pending before merging label Jan 25, 2022
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Still don't love the method map with repeated methods, but has my approval for merge either way. Thanks!

@hairyhenderson hairyhenderson force-pushed the metrics-restrict-http-methods branch from dcafbf4 to 7ca5921 Compare January 25, 2022 20:07
@hairyhenderson hairyhenderson merged commit 741b050 into caddyserver:master Jan 25, 2022
@hairyhenderson hairyhenderson deleted the metrics-restrict-http-methods branch January 25, 2022 20:34
@mholt
Copy link
Member

mholt commented Jan 26, 2022

Nice work Dave, thank you so much for helping with this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants