Should grafana range query understand the stats values pipe?
A colleague came to me with what I thought was going to be a simple question: how to plot values out of a field in logs. Since range queries are done with a stats pipe, and there's a values stats pipe function, I figured this would be it.
Grafana doesn't understand what to do with the array, though. I can't unroll it after the stats pipe, and even if the values are broken up via something like ... | stats by (_time) values(my_field), it still doesn't know what to do with the single-element "['###']" arrays.
The most direct way we found to achieve what we wanted is to actually do a raw logs query instead of a range, and then a transformation to extract the fields, and another to treat the desired field as a Number.
This works... but it's a little awkward that the datasource doesn't offer a way to do this directly without resorting to grafana transformations.
We're using v0.18 of the datasource plugin.
I suppose my questions are:
- Is this (raw log query + transformations) the intended way to plot fields out of logs?
- I could see the position being "plotting field values isn't a statistic per se so this shouldn't be done as a stats function", but just not sure because this is a relatively common task to require transformations to work.
- Like all the other stats pipe functions, should grafana understand what to do with
stats values()results?- Am I possibly just doing this wrong somehow?
Thanks as always!