Hi there, I have a key/value variable. This allows me to select multiple servers for my dashboard as they use the same metrics and comparisons can be useful.
However, I’m unable to get my “friendly” (key) name for the server. As if I use the ${variable:text}
it results in server1 + server2 + ...
instead of just server1
, meaning that every server has the same label. Anyone know how to do this (get the key by value from a variable)?
you have the following options
${countries:csv} ${countries:json} ${countries:singlequote}
see this thread
https://community.grafana.com/t/replace-symbol-with-replace-in-grafana-multi-select-custom-variable/127568/6
This allows me to format it in a different format, but it still concatenates all
keys which is not the desired behavior. I need to get one value (the current server), because otherwise it will give the same legend for each server.
Maybe some extra context would be useful, my prometheus query looks something like this: mymetric{server=~"$selectedServers"}
I also do not have the friendly names in my prom data.
I know that I can manually add a regex rename transformation, but this would be a pain, as it would require us to redo this for every panel, and it also doesn’t have one source of truth?
I’m surprised that there is no simple way (or that I haven’t found yet) to do this as it seems like pretty basic functionality?
rn I have solved it with providing overrides for the value, but a more automated/single source of truth approach would be nice to have