grafana / grafonnet-lib

Jsonnet library for generating Grafana dashboard files.
https://grafana.github.io/grafonnet-lib/
Apache License 2.0
1.08k stars 217 forks source link

template.custom does not support commas in values #325

Open AndiDog opened 3 years ago

AndiDog commented 3 years ago

Here's a valid multi-value query for a custom variable that works in Grafana:

cluster="a"\,app="foo",cluster="b"\,app="foo"

which leads to 2 values cluster="a",app="foo" and cluster="b",app="foo".

Unfortunately grafonnet's implementation does a simple split like this (code taken from grafonnet/template.libsonnet):

query_array(query):: std.split(
  if includeAll then 'All,' + query else query, ','
),

and therefore creates more than 2 values by accident.

This could either be fixed, or an options field provided as alternative to query?! The bug means that visualizations with variable repeat can't be nicely developed with grafonnet yet 😐