0

I don't use stack overflow to ask questions much so please let me know if you need more details.

Looking around the internet I couldn't find anyone with this problem:

  • I have created a variable that can have multiple values. Example: cluster = [1, 2, 3]
  • My panel is REPEATED and when I select ALL VALUES it wrongly queries using ALL VALUES instead of each value SEPARATELY

Here is an example of what it does: SELECT CPUUtilization FROM datasource WHERE ClusterIdentifier = $cluster turns into SELECT CPUUtilization FROM datasource WHERE ClusterIdentifier = {1, 2, 3} FOR ALL the panels.

I need it to be:

SELECT CPUUtilization FROM datasource WHERE ClusterIdentifier = 1

SELECT CPUUtilization FROM datasource WHERE ClusterIdentifier = 2

SELECT CPUUtilization FROM datasource WHERE ClusterIdentifier = 3

for each individual panel.

The panel title is aptly named "$cluster", the title of the panel updates correctly. 3 panels will be created each named 1, 2, and 3.

However, the query it returns (I checked by inspecting the panel in dashboard view) includes EVERY SINGLE POSSIBLE VALUE for the $cluster instead of one at a time.

I believe the reason for this is because of an EXPRESSION I have, checking if any of the queries with in the panel goes over a certain limit. When removing the expression, everything works as intended. However, when I add any expression, all the panels break.

Please let me know if there is a solution or if there's any more details I can give.

The top row is without an expression, the bottom row contains an expression: enter image description here

My Boi
  • 23
  • 1
  • 4
  • What is the variable type? Can you post a screenshot of the `Variables>Edit` window that you see when you edit the variable? What is listed under "Preview of values" in the variable editing window? – crock Jun 10 '22 at 23:51
  • Unfortunately, this contains company information that I cannot share, but the list of Preview of Values looks something like: All, cluster1, cluster2, cluster3, etc. Also, I forgot to mention that expressions (edited the original post to reflect that) might be causing the issue. – My Boi Jun 10 '22 at 23:53
  • Is the datasource MySQL? I know for Prometheus datasources you need to use regex matching on Grafana query variables, ex metric{label=~"$variable"} or else you get wacky results, perhaps it's something similar to that. Try MySQL [regexp](https://dev.mysql.com/doc/refman/8.0/en/regexp.html#operator_regexp) – crock Jun 10 '22 at 23:59
  • The datasource is coming from CloudWatch metrics on some AWS Redshift clusters. I will look into regex matching though, thank you. I also updated the original question with an image if that helps – My Boi Jun 11 '22 at 00:05

0 Answers0