- What Grafana version and what operating system are you using? Grafana v12.2.1, Debian 12
I have a timeseries scraped from Prometheus-style metrics, with a label for each of several devices to be able to report their cubic-feet-per-minute reading from a flow sensor.
I’m trying to use flux to integrate the area under the curve, to produce a graph of cubic feet. Ideally I’d like it to start over at zero each day, and linearly interpolate between metric scrape values.
After a couple days of trying, I don’t feel like I’m any closer to getting something to do what I want. I think I need to do it in two steps, integrate in short steps and then sum over 24 hour periods.
from(bucket: "sensors")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "flowcfm")
|> group(columns: ["device"])
|> aggregateWindow(every: 5m, fn: mean, createEmpty: false)
|> integral(unit: 5m)
|> duplicate(column: "_start", as: "_time")
|> aggregateWindow(every: 24h, fn: sum, createEmpty: false)
When I tried, the graph couldn’t display because there was no _time column. Some searching suggested using the _start timestamp for _time.
However, the statement above only shows one datapoint back at the start of data collection, and I don’t understand how to proceed.