Ways to interpret dashboard custom variables

  • What Grafana version and what operating system are you using?
    Grafana v8.3.4 @ CentOS 7

  • What are you trying to achieve?
    Trying to interpret a custom variable in 2 ways; it’s key and it’s value.

  • How are you trying to achieve it?
    I’ve got 2 custom variables on my dashboard.
    VAR1 equals group of key-values: QA : group1|group2|group3
    VAR2 equals group of key-values: QA2 : group4|group5|group6

    • So, if I use it on a dashboard as ${VAR1:raw}, it works correctly — I get a group of values passed to a Prometheus datasource. The question is — can I use the same variable, VAR1 or VAR2, in a different way, to get it’s key as a value and pass it to my Elasticsearch datasource? So that query would become something like ${VAR1:key}
  • What happened?
    Dasboard doesn’t display any information.

  • What did you expect to happen?
    Dashboard loads properly, custom variable’s key can be used as a value in query.

  • Can you copy/paste the configuration(s) that you are having problems with?
    Custom variable VAR1: QA : group1|group2|group3
    Custom variable VAR2: QA2 : group4|group5|group6

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Did you follow any online instructions? If so, what is the URL?