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

middleware(prom): add customizable label for http metrics #747

Merged
merged 2 commits into from
Jun 11, 2024

Conversation

Choraden
Copy link
Contributor

It can be used to partition the metrics by custom conditions. e.g. Label direct/tunnel mode in SC5.

PrometheusOpt was chosen to ensure compatibility with existing prom instances.

Comment on lines 58 to 59
label string
labeler func(*http.Request) string
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better as a type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

http_proxy.go Outdated
@@ -94,6 +94,7 @@ type HTTPProxyConfig struct {
ConnectTimeout time.Duration
ReadLimit SizeSuffix
WriteLimit SizeSuffix
PromHTTPOpts []middleware.PrometheusOpt
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add it to PromConfig tbh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding it here makes no sense. It is very specific, while PromConfig is widely used across all components.

@mmatczuk
Copy link
Contributor

What is the status of this PR?

@Choraden
Copy link
Contributor Author

Looks like it's good to go. Let's discuss it during our meeting.

@mmatczuk mmatczuk self-requested a review June 11, 2024 09:33
It can be used to partition the metrics by custom conditions.
e.g. Label direct/tunnel mode in SC5.

PrometheusOpt was chosen to ensure compatibility with existing prom instances.
@mmatczuk mmatczuk merged commit 8efb92f into main Jun 11, 2024
6 checks passed
@mmatczuk mmatczuk deleted the hg/metrics_http_req_label branch June 11, 2024 09:57
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