Repeat panels based on custom defined dashboard variable

  • What Grafana version and what operating system are you using?
    Grafana v9.3.0

  • What are you trying to achieve?
    I’ve created a custom dashboard variable $queue by using the following query:


The result of this query is a list of all metrics that start with the redis_queue_.

This variable is a multi-select. What I want to do is to create a repeatable panel based on the following expression:

  • How are you trying to achieve it?
    I’ve created a Time Series panel and applied said expression. I’ve also configured repeat settings to horizontal, two per row.

  • What happened?
    When I select only one value from a dropdown, everything is fine. However, if I select multiple values, I get the following error:

422: error when executing query="sum((redis_queue_messages|redis_queue_questions))" on the time range (start=1681985985000, end=1681986885000, step=15000): cannot recognize "|redis_queue_messages))"; unparsed data: "redis_queue_messages|redis_queue_questions))"
  • What did you expect to happen?
    Each panel should display a sum of values for each selected value from the $queue variable. In the case above, I was expecting to get two panels, each showing a sum of redis_queue_messages and redis_queue_questions separately.

So, I need to find a way to repeat panels and do a sum per selected value, not of all values at once. How can I achieve this?

To answer myself - I’ve made a syntax error, used sum({__name__~="$queue"}) instead of sum({__name__=~"$queue"}) :man_facepalming: