I am trying to draw a a barchart in Grafana with a prometheus datasource. My simple query looks as follows:
max_over_time(energy_monitor_watthour_today[1d])
I have Grafana set to the interval of 1d (This works fine, and gives me the highest point for each day). but using this, all of my results are exactly 1 day too far in the future. I would like to essentially give my results an offset that pushes them 1 day into the past.
I have tried using Prometheus's Offset function for queries:
max_over_time(energy_monitor_watthour_today[1d] offset 1d)
But this gives the exact opposite effect, and moves all my results 1 day into the future. using a negative offset like so:
max_over_time(energy_monitor_watthour_today[1d] offset -1d)
results in the following error:
parse error at char 57: unexpected in offset, expected duration
I have also tried to use Grafana's time shift feature, but this will just move my graph's timeframe, not change the actual date.
How can I move all the results of my query one day into the past?
This is not possible to achieve with Prometheus. see: github. Switching to InfluxDB resolved the issue. Existing data can be migrated using Prom2Influx.
Edit: This is possible with a newer version of Prometheus! link
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With