victorialogs-datasource: Queries with `stats` don't work
When running any query from Grafana with a stats pipe I get got unexpected response status code: 400. The same query without the stats pipe works and returns data.
Smallest query which reproduces this error: test | stats count()
I see this error for the above query in the VM logs:
{"ts":"2024-06-22T21:14:51.057Z","level":"warn","caller":"VictoriaMetrics/app/vlselect/logsql/logsql.go:291","msg":"remoteAddr: \"10.1.11.41:52548\"; requestURI: /select/logsql/query?limit=1000&query=_time%3A%5B2024-06-22T20%3A59%3A51.041Z%2C+2024-06-22T21%3A14%3A51.041Z%5D+AND+%28test+%7C+stats+count%28%29%29; cannot parse query [_time:[2024-06-22T20:59:51.041Z, 2024-06-22T21:14:51.041Z] AND (test | stats count())]: unexpected token \"|\" instead of ')'; context: [:59:51.041Z, 2024-06-22T21:14:51.041Z] AND (test |]"}
So it seems that in the presence of a stats pipe in the query, the timestamp (which I guess the plugin adds by itself) is added through an AND which makes the whole query invalid.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (10 by maintainers)
I fixed it. With the plugins installed in the directory
./provisioning/plugins, it did not work for me. Perhaps there were no write permissions./provisioning/plugins:/var/lib/grafana/plugins, where the plugins of the new versions were located. After I disabled the mounting of the plugin volume and entered a environment variableGF_INSTALL_PLUGINS=https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.2.2/victorialogs-datasource-v0.2.2.zip;victorialogs-datasource,https://github.com/VictoriaMetrics/grafana-datasource/releases/download/v0.8.2/victoriametrics-datasource-v0.8.2.zip;victoriametrics-datasource, after that stats worked correctly