Prometheus aggregate table data from offset; ie pull historical data from 2 weeks ago to present


so i am constructing a table within grafana with prometheus as a data source. right now, my queries are set to instant , and thus it’s showing scrape data from the instant that the query is made (in my case, shows data from the past 2 days)

however, i want to see data from the past 14 days. i know that you can adjust time shift in grafana as well as use the offset <timerange> command to shift the moment when the query is run, however these only adjust query execution points.

using a range vector such as go_info[10h] does indeed go back that range, however the scrapes are done in 15s intervals and as such produce duplicate data in addition to producing query results for a query done in that instant (and not an offset timepoint), which I don’t want

I am wondering if there’s a way to gather data from two weeks ago until today, essentially aggregating data from multiple offset time points.

i’ve tried writing multiple queries on my table to perform this, e.g:

go_info offset 2d go_info offset 3d and so on..

however this doesn’t seem very efficient and the values from each query end up in different columns (a problem i could probably alleviate with an alteration to the query, however that doesn’t solve the issue of complexity in queries)

is there a more efficient, simpler way to do this? i understand that the latest version of Prometheus offers subquerys as a feature, but i am currently not able to upgrade Prometheus (at least in a simple manner with the way it’s currently set up) and am also not sure it would solve my problem. if it is indeed the answer to my question, it’ll be worth the upgrade. i just haven’t had the environment to test it out

thanks for any help anyone can provide :slight_smile: