Search code examples
amazon-web-servicesprometheusgrafanadashboardamazon-eks

Adding dynamic variable in the grafana query


I am working over creating grafana queries by using the dynamic variable whose values get populated from the dropdown when the user selects the env.

My query is

metric_avg_total{env="$env",job="job1", topic=~"$env_read_val_topic"}

The topic value that I want to use is corr to the env.

eg: dev_read_val_topic qas_read_val_topic

If I write the query as

metric_avg_total{env="$env",job="job1", topic=~"dev_read_val_topic"}

I am able to see the graph.

But using $env_read_val_topic doesnt replacce the values of the $env with the values selected as env from the dropdown.


Solution

  • Try to use the following query:

    metric_avg_total{env="$env",job="job1", topic="${env}_read_val_topic"}