Cubic-feet-per-second accumulated over time w/ PromQL?

I am scraping metrics which export cubic feet per second from a gas flow sensor. I would like to graph this over time, ideally starting over at zero each day and showing the total number of cubic feet accumulated throughout the day.

I thought sum_over_time(flowcfs[1d:1d]) might be useful but I’m concluding it isn’t the right way to sum each flowcfs sample times the number of seconds until the next sample.

I think I want to integrate the area under the flowcfs curve but I’m not using InfluxDB which has that function, I’m using Prometheus and PromQL.

What I’d really like is a diagonal line which resets to zero each day and grows throughout the day according to each flowcfs sample as we receive them. Is there a way using PromQL to accumulate a physical-unit-per-second metric into a sum over time which I’ve missed, or do I need to switch to InfluxDB and use integral() ?

  • What Grafana version and what operating system are you using? Grafana v12.2.1, Debian 12

  • What are you trying to achieve? graph cubic-feet-per-minute (cfm) daily

1 Like

No, PromQL doesn’t have that function:

You will need better metric storage, e.g. mentioned InfluxDB, VictoriaMetrics,…