Skip to content

grafana "textbox" variable is put into quotes from 0.21.4 on #454

@localpref

Description

@localpref

Describe the bug

I have been using (besides a lot of grafana multi-select vars) a grafana variable of type "textbox" to add ad-hoc filters to a dashboard, i.e. my queries look like

_stream: {source_type in ("syslog", "socket")}
  AND baz: in($baz_fields)
  AND foobar: in($foo_fields)
  $textbox_filter

where I could put logsQL like parsed.appname: in(a,b) AND hostname: acme* into the textbox and have it appended to the filter verbatim, which is nice as all my graphs & bars update as they use the same filter query. A change between 0.21.1 and 0.21.4 started quoting all variable expansions, so this becomes "parsed.appname: in(a,b) AND hostname: acme*", forcing LogsQL to search for the literal string instead of the actual LogsQL query it is supposed to be. Before, I was free to use " myself if I had certain literal parts in my free-form filter.

I would like to exempt textbox-type variables from the "must be quoted" rule - I understand the quoting was added around some corner cases with length-1-lists etc, and in every place we work with (non-custom!) values from a grafana variable I would agree with that, but for textbox I would disagree. As it is, this patch took functionality away for me, making it far less useful (because even though I can take the query to explore or vmui and do my filtering there, but that will not update my whole dash with all the graphs) than with 0.21.1.

Alternatively, some form of magic prefix or suffix that unquotes would work for me, e.g. instead of $textbox_filter, $##noqoute##textbox_filter? I realise that my use case might be uncommon (but, as I said, it is very useful)

Re-reading this, I think maybe the difference can be put into "custom" vs "calculated" fields? For everything that comes from a grafana query of sorts ("calculated"), quoting is probably the right thing to do, but for custom fields (where textbox is a prime example, but multi-select vars can also have custom values, and some custom lists as well) a case could be made that necessary quoting could be put onto the user's decision.

To Reproduce

add a grafana textbox variable and reference it in a LogsQL query. Quoted in 0.21.4, unquoted in 0.21.1

Versions of VictoriaLogs datasource and VictoriaLogs backend

worked in v0.21.1, stopped working from v0.21.4

Link to dashboard in Victoria Metrics

No response

Please provide dashboard JSON if it is possible

No response

Additional information

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions