Multi-value variable formatting limits in chained Grafana dashboards
0 reputation · 10 Feb 2022, 21:34 UTC
0 reputation · 10 Feb 2022, 21:34 UTC
Grafana dashboard variables support multi-value selection, allowing panels to receive arrays or formatted strings for dynamic filtering. When variables are chained, a parent variable's selection filters the options available to a child variable, creating hierarchical dependencies. The documentation notes that multi-value variables can be passed as arrays or formatted strings, but the exact interpolation syntax varies depending on the data source plugin. Additionally, the "All" option can be configured to send a specific value or a regex pattern to the underlying query.
High-cardinality variables are associated with significant browser-side memory consumption and slow dashboard loading, while complex chained variables may cause cascading query execution that increases load on the data source. These behaviors raise questions about the practical limits of combining multi-value selections with chained dependencies, particularly when the "All" option is used across plugins with different interpolation requirements.
What documented limits exist for the number of values or cardinality of multi-value variables in chained configurations? How does Grafana determine the final formatted string sent to the data source when a chained multi-value variable uses the "All" option with a regex pattern? Are there plugin-specific constraints that prevent certain multi-value formatting patterns from working reliably in cascading query scenarios?
35275 reputation · 10 Feb 2022, 22:18 UTC
Grafana does not define a documented hard numeric limit for the number of values or cardinality of multi-value variables in chained configurations. Practical limits emerge from browser memory consumption, dashboard load time, cascading query execution, data source query size restrictions, and URL length constraints when variables are passed between dashboards.
When a chained multi-value parent variable uses the All option, Grafana substitutes the parent's resolved value into the child variable's query. If a custom All value is configured, that exact string is used; otherwise the data source plugin determines the default "match everything" representation, which is often a regex pattern for sources that support regex matching.
The final formatted string sent to the data source is produced by applying the requested variable format—such as ${var:csv}, ${var:regex}, or ${var:json}—to the resolved selection. Expanding a regex All value as CSV yields a literal list, not a pattern, so the child query must use a format compatible with the data source.
Plugin-specific constraints do exist: data sources without regex operators may reject or misinterpret a regex All value, and SQL, Prometheus, InfluxDB, and other plugins implement multi-value interpolation and All behavior differently.
Confirmed: Grafana's documentation warns that high-cardinality variables increase browser memory and slow dashboard loading, and chained variables can trigger cascading queries. The variable format controls how the resolved selection is rendered before substitution.
Likely / uncertain: The exact default All regex pattern is version- and plugin-dependent; do not hard-code assumptions about the emitted string. A regex All value combined with a non-regex format such as CSV can send a literal string that the data source treats as a single discrete value.
One missing diagnostic detail would change the recommendation: which data source plugin and version are you using? Interpolation syntax, default All behavior, and regex support vary by plugin, so the safe next step depends on that answer.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.