-
Notifications
You must be signed in to change notification settings - Fork 465
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
Fix Prometheus metrics #773
Conversation
cc @zirain |
dup of #716 ? |
Yes, I missed that one. The chore: replace dots in ipv4 addresses with slashes is pretty much the same as the mentioned PR - just a bit more generic regexp and without tests. |
I'd like to close my PR as this one is better. |
Squashed the fixup commit for merging |
hey @rofafor can we split up the fix into 2 PRs, and use this PR for fixing the the |
Done by dropping the first commit. Do you want me to create another PR for the dropped identical-key-value commit or do you track down the actual issue with a proper fix? |
would be great if you can create a GH issue in https://github.com/envoyproxy/gateway/issues for it |
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 thanks !
@rofafor looks like a test is failing with the changes |
@arkodg Thanks for pointing it out. The error was due to fact that 4th capturing groups weren't optional. I can't figure out why I didn't spot this in December, but anyways now it works within my development setup ( |
src/utils/utilities.go
Outdated
@@ -65,5 +66,9 @@ func MaskCredentialsInUrl(url string) string { | |||
// Remove invalid characters from the stat name. | |||
func SanitizeStatName(s string) string { | |||
r := strings.NewReplacer(":", "_", "|", "_") | |||
return r.Replace(s) | |||
ipv4Pattern := `\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}` |
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.
would it be better to make this as const?
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.
optimized it a bit by moving the static regex compilation out of the function
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.
small nit
Signed-off-by: Rolf Ahrenberg <rolf.ahrenberg@saunalahti.fi>
Signed-off-by: Rolf Ahrenberg <rolf.ahrenberg@saunalahti.fi>
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.
@psbrar99 @collin-lee PTAL
Issue
Ratelimit Prometheus metrics are kind of mess with the latest Envoy Gateway. The included patch tries to solve these issues:
Avoid repeating (optional) value if it's identical to key. This simplifies Prometheus labels by removing unnecessary duplication.Ratelimit configuration
Envoy configuration
Envoy Ratelimit logs
Ratelimit /metrics in current master
Ratelimit /metrics with this patch