Prometheus query range start/end timestamp issue

1,789 views
Skip to first unread message

georgia...@gmail.com

unread,
Sep 28, 2016, 5:56:42 PM9/28/16
to Prometheus Developers
Hi,
Does the query range start/end timestamp has to be exactly match with the data timestamp in prometheus database?
I found an issue for prometheus when I apply start/end timestamp to get a list of traffic rate, please see below query:
http://IP:9090/api/v1/query_range?query=rate(myTraffic99[5m])&start=1474830575.527&end=1474916975.527&step=3600s

Above query returns a list of traffic rate(caculated every 5m) using hourly step from Sun, 25 Sep 2016 19:09:35 GMT to Mon, 26 Sep 2016 19:09:35 GMT.

However if I remove the millisecond from timestamp in the above query as below, it returns an empty array.
http://IP:9090/api/v1/query_range?query=rate(myTraffic99[5m])&start=1474830575&end=1474916975&step=3600s

The return is: {"status":"success","data":{"resultType":"matrix","result":[]}}

Is this a bug? It should return the same list back, right? If I change millisecond to different number, it also returns empty array back. It seems I have to give the timestamp which is exactly in the raw data list, then the query works.

Also I found if I change step=300s(5min), then the second query works, but I need to get an average traffic rate in daily base, so when I change step to 86400s(24Hours) it works only if I provide the timestamp exactly match with the timestamp in the database.

Thanks,
Georgia

Brian Brazil

unread,
Sep 28, 2016, 6:14:23 PM9/28/16
to georgia...@gmail.com, Prometheus Developers
On 28 September 2016 at 22:56, <georgia...@gmail.com> wrote:
Hi,
Does the query range start/end timestamp has to be exactly match with the data timestamp in prometheus database?
I found an issue for prometheus when I apply start/end timestamp to get a list of traffic rate, please see below query:
http://IP:9090/api/v1/query_range?query=rate(myTraffic99[5m])&start=1474830575.527&end=1474916975.527&step=3600s

Above query returns a list of traffic rate(caculated every 5m) using hourly step from Sun, 25 Sep 2016 19:09:35 GMT to Mon, 26 Sep 2016 19:09:35 GMT.

That's not what that query does. Once an hour, it gets the per-second rate of traffic over the previous 5 minutes. It's very unlikely this is the query you want, I'd suggest increasing the range in the rate to 1h.
 

However if I remove the millisecond from timestamp in the above query as below, it returns an empty array.
http://IP:9090/api/v1/query_range?query=rate(myTraffic99[5m])&start=1474830575&end=1474916975&step=3600s

The return is: {"status":"success","data":{"resultType":"matrix","result":[]}}

Is this a bug? It should return the same list back, right? If I change millisecond to different number, it also returns empty array back. It seems I have to give the timestamp which is exactly in the raw data list, then the query works.

This can happen if you have data points that are not dense enough. The range should generally cover 2-3 samples for safety.

Brian
 

Also I found if I change step=300s(5min), then the second query works, but I need to get an average traffic rate in daily base, so when I change step to 86400s(24Hours) it works only if I provide the timestamp exactly match with the timestamp in the database.

Thanks,
Georgia

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Vaisakh Rajagopal

unread,
Jul 2, 2018, 10:15:46 AM7/2/18
to Prometheus Developers
Hi Brian Brazil,

That's not what that query does. Once an hour, it gets the per-second rate of traffic over the previous 5 minutes. It's very unlikely this is the query you want, I'd suggest increasing the range in the rate to 1h.
Can you elaborate this "per-second rate over the previous 5 minute" !
When we mention the range as 5m, will it consider the last 5 mintue date from 1474916975.527. [1474916975.527 - 5 minutes, 1474916975.527]

Brian Brazil

unread,
Jul 2, 2018, 10:23:04 AM7/2/18
to Vaisakh Rajagopal, Prometheus Developers
On 2 July 2018 at 15:15, Vaisakh Rajagopal <var2...@gmail.com> wrote:
Hi Brian Brazil,
That's not what that query does. Once an hour, it gets the per-second rate of traffic over the previous 5 minutes. It's very unlikely this is the query you want, I'd suggest increasing the range in the rate to 1h.
Can you elaborate this "per-second rate over the previous 5 minute" !
When we mention the range as 5m, will it consider the last 5 mintue date from 1474916975.527. [1474916975.527 - 5 minutes, 1474916975.527]

Yes, that's what it's doing.

Brian 


On Thursday, 29 September 2016 03:26:42 UTC+5:30, georgia...@gmail.com wrote:
Hi,
Does the query range start/end timestamp has to be exactly match with the data timestamp in prometheus database?
I found an issue for prometheus when I apply start/end timestamp to get a list of traffic rate, please see below query:
http://IP:9090/api/v1/query_range?query=rate(myTraffic99[5m])&start=1474830575.527&end=1474916975.527&step=3600s

Above query returns a list of traffic rate(caculated every 5m) using hourly step from Sun, 25 Sep 2016 19:09:35 GMT to Mon, 26 Sep 2016 19:09:35 GMT.

However if I remove the millisecond from timestamp in the above query as below, it returns an empty array.
http://IP:9090/api/v1/query_range?query=rate(myTraffic99[5m])&start=1474830575&end=1474916975&step=3600s

The return is: {"status":"success","data":{"resultType":"matrix","result":[]}}

Is this a bug? It should return the same list back, right? If I change millisecond to different number, it also returns empty array back. It seems I have to give the timestamp which is exactly in the raw data list, then the query works.

Also I found if I change step=300s(5min), then the second query works, but I need to get an average traffic rate in daily base, so when I change step to 86400s(24Hours) it works only if I provide the timestamp exactly match with the timestamp in the database.

Thanks,
Georgia

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages