node_load1 * on (instance, job) group_left(version) version{version=“1”} offset 24h
node_load1 * on (instance, job) group_left(version) version{version=“2”} offset 24h
Can I figure out the start and end timestamps for version{version="1"} so I can programmatically set the offsets?
If this is not possible (though I really really hope it is) would the recommendation be to post the offsets somewhere else pre-calculated for each version and patch Grafana or the prometheus console templates to get it or post the offsets to the Grafana dashboards API?
Are there other ways to accomplish what I am doing? Even if I add a label for the version for every metric that this system and application exports I am still left with super imposing them on the same graph which means calculating the offset.
Thanks for your time,
Dennis O.
On 17 May 2016 at 23:38, Dennis Ordanov <daod...@gmail.com> wrote:
>
> I have a metric that is akin to the role metric that I am accepting
> discontinuity for and I would like to figure out the timestamps using the
> http api or anyway from prometheus really.
>
> Let's say, I use the textfile collector to send a metric like this using the
> node_exporter:
>
> version{version="1.1"} # Apr 2 - Apr 3
> version{verson="1.2"} # Apr 4 - Apr 5
You still need to add a sample value here (usually "1" for a metric like that).
> If I want to graph node_load1 and compare between the two versions I can do
> something like this (I think this is working like I want it to?) I have a
> build from HEAD of prometheus with the group_left changes.
>
> node_load1 * on (instance, job) group_left(version) version{version=“1”}
> offset 24h
>
> node_load1 * on (instance, job) group_left(version) version{version=“2”}
> offset 24h
>
>
>
> Can I figure out the start and end timestamps for version{version="1"} so I
> can programmatically set the offsets?
There is no way to set the offset programmatically _within_ PromQL.
You could write a separate program that queries the time series for
`version`, picks the first timestamp for each series, and then
assembles a PromQL query with the right offset and runs it against the
Prometheus server (or pushes it into a Grafana dashboard).
It would require a lot of rewiring within the core of PromQL to make
your use case work within PromQL.
Hi,This is kind of working, but guessing the step value is proving challenging or I am doing something else wrong to figure out the beginning of a metric + label combination.I am using some made up dates and they are only about a day apart afaict and I receive an error.$ curl 'localhost:9090/api/v1/query_range?query=wrk_http_benchmark_up&start=2016-05-18T20:10:30.781Z&end=2016-05-22T20:10:30.781Z&step=30s'{"status":"error","errorType":"bad_data","error":"exceeded maximum resolution of 11,000 points per timeseries. Try decreasing the query resolution (?step=XX)"}1) If I change this to 40 seconds it starts working, where is the 11k timeseries number coming from and how would I use start = 1 for instance in this case and if I use a time_range even farther in the past then I have to use an even larger resolution.2) I tried using a label in hopes that I get better results, but I just get no results, is the below even the correct syntax?$ curl -v 'localhost:9090/api/v1/query_range?query=wrk_http_benchmark_up\{run="31"\}&start=2016-05-18T20:10:30.781Z&end=2016-05-23T20:10:30.781Z&step=50s'I was imagining I can do something like$ curl -v 'localhost:9090/api/v1/query_range?query=wrk_http_benchmark_up\{run="31"\}&start=1&end=2016-05-23T20:10:30.781Z&step=10s' # I only need the first timestamp (though getting the last time stamp would be nice too.