Use Variable in "Field with name matching regex"

I am trying to use a variable inside the regex of my field override. I have a graph showing software versions of hunders of machines and have a dashboard variable input with “Target Chrome Version” this version is a normal input and should not be the full version string. The goal of this is to have the target version marked green. (see pic below). Since this version changes really frequently I dont want to keep having to change the regex within the chart itself and thus want to use this variable.

I’ve tried using the regex value ```^${chrome_target_version}.*``` but this doesnt seem to work as all items stay red. Do you guys have any solutions?

Im running a docker container of “grafana/grafana-oss:latest”

${chrome_target_version}.* in Fields with name matching regex doesn’t appear to apply the override correctly. With chrome_target_version=150.0.7871, both 150.0.7871.115 and 150.0.7871.124 should match the regex, yet they aren’t colored consistently.

Setting a query’s Alias to ${chrome_target_version} does resolve correctly, which suggests dashboard variables are interpolated in queries but not in the override matcher.

Possible workaround: if your datasource/query lets you relabel the matching series, give it a fixed name (for example, Target Version) and use a Fields with name override instead of a regex override. If not, could you share the query and datasource? There may be another way to identify the target series.



Thanks for your reply!

I am using the zabbix plugin for Grafana " Zabbix plugin for Grafana | Grafana Labs "

Below is a screenshot of my current query. I have tried setting 2 queries, 1 for retrieving client update data and 1 for retrieving the updates itself. and then using transformations with filters for each query to get the right format of data. I was close to solving it but then had the issue that the labels of both data sources where the exact same and also with data. causing the pie chart to show double data for the ones that match. I thought about having a workaround that would set the data of the second query to all 0’s but couldnt get this to work.

This looks like a limitation in the field override matcher rather than the Zabbix datasource. If replacing ^${chrome_target_version}.* with a literal regex like ^150\.0\.7871.*
does work, but the variable version doesn’t, it would suggest dashboard variables aren’t being interpolated by Fields with name matching regex matcher.

I don’t think the two-query workaround will help for a pie chart, since both queries produce fields with the same names, so Grafana renders them as separate slices instead of using one only for coloring.

If your query supports aliasing the matching series to a fixed name (for example, Target Version), you can use a Fields with name override instead of a regex override.