-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Fix service name label_replace in Grafana #10758
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 service name label_replace in Grafana #10758
Conversation
|
Hello @xdavidwu, Thanks for your contribution. Could you please rebase your PR on branch v2.11? |
This issue only exists on branch v3.0 and master. Which one should I target? |
|
Oops my bad, you can target |
7e706dc to
ec320fb
Compare
mmatur
left a comment
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
rtribotte
left a comment
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.
Thanks!
kevinpollet
left a comment
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.
Thanks 👍
The kubernetes (ingress) provider create services named `<namespace>-<service name>-<port>`, other kubernetes providers (crd, gateway) also name their services in similiar fashion, combining names from kubernetes with '-'. Most kubernetes resources requires their name to be usable as dns subdomain names only, therefore '-' is also possible in names (actually quite common, like kube-system, kube-controller-manager). label_replace here before extracts first two part seperated with '-'. The intention here is probably to extract `<namespace>-<service name>`, but with '-' in namespaces or service names, this breaks and usually generates labels that are not unique. If there are query operation after label_replace, it is also fragile, due to having multiple series with same labels. This fixes it by removing only `@<providername>` instead. '@' is invalid for names in most kubernetes resources, so this should be safe.
ec320fb to
58ac35b
Compare
The kubernetes (ingress) provider create services named
<namespace>-<service name>-<port>, other kubernetes providers (crd, gateway) also name their services in similiar fashion, combining names from kubernetes with '-'. Most kubernetes resources requires their name to be usable as dns subdomain names only, therefore '-' is also possible in names (actually quite common, like kube-system, kube-controller-manager).label_replace here before extracts first two part seperated with '-'. The intention here is probably to extract
<namespace>-<service name>, but with '-' in namespaces or service names, this breaks and usually generates labels that are not unique. If there are query operation after label_replace, it is also fragile, due to having multiple series with same labels.This fixes it by removing only
@<providername>instead. '@' is invalid for names in most kubernetes resources, so this should be safe.What does this PR do?
Fix service name extraction on dashboard for traefik on kubernetes.
Motivation
More
Additional Notes