We do this so we can have the hostname in the legend without the fqdn and port appearing which is entirely redundant for these metrics since they’re always coming from the same service within a cluster.
It really clutters up our promql metrics and make it a real pain to copy the metrics around. It seems like it this is really a display formatting issue and would be better handled in the legend format string, something like:
Better yet would be to be able to define this as a common expression in the dashboard config and then just use host as if it was a label without having to put this on every legend field.
Is anything like this possible today or is this a feature request?
I am running into the same issue. Did you put the whole expression (label_replace(x, “instance”, “$1”, “instance”, “([^.]+).*”)) in the legend field? or is this used in the expression field where x is you metric query?
Can anybody let me kow, How to display only pod name from Ex: ic-nginx-ingress-ingress-nginx-controller-5fcb5 replace to c-nginx-ingress-ingress-nginx-controller. Also danm-cni-gm4wl
replace to “danm-cni”
Do you have any idea or Reg Expr I can use to achieve this filtration from pod name