Bug on Time based Functions, PromQL

22 views
Skip to first unread message

Aditya Nageswar

unread,
Mar 4, 2020, 3:01:51 PM3/4/20
to Prometheus Users

What happened?
Cannot merge queries for time based functions

To Filter from 1:00 to 18:30, used the below query

(vector(1) and ((hour() >= 01) and ((hour() <= 18) and (minute() <= 30 )) )) or (vector(0))

This gave result as,
image

Did you expect to see something different?

The query should be giving vector 1 from 1:00 to 18:30, Instead Filters time for every 30 mins,

As an alternative tried the below query which doesn`t help,

(vector(1) and ((hour() >= 01) and (hour() <= 18.5) )) or (vector(0))

Environment

Kubernetes Version: 1.11.6
Prometheus Version: 2.4.3

Julien Pivotto

unread,
Mar 4, 2020, 3:33:45 PM3/4/20
to Aditya Nageswar, Prometheus Users
On 04 Mar 12:01, Aditya Nageswar wrote:
>
>
> What happened?
> Cannot merge queries for time based functions
>
> To Filter from 1:00 to 18:30, used the below query
>
> (vector(1) and ((hour() >= 01) and ((hour() <= 18) and (minute() <= 30 ))
> )) or (vector(0))

vector(1) and (hour() >= 01 and hour() <= 18) or ( hour() == 18 and
minute() <= 30) or vector(0)


>
> This gave result as,
> [image: image]
> <https://user-images.githubusercontent.com/30234760/75909044-4e86e480-5e71-11ea-9cd2-6a271f10fff1.png>
>
> Did you expect to see something different?
>
> The query should be giving vector 1 from 1:00 to 18:30, Instead Filters
> time for every 30 mins,
>
> As an alternative tried the below query which doesn`t help,
>
> (vector(1) and ((hour() >= 01) and (hour() <= 18.5) )) or (vector(0))
>
> Environment
>
> Kubernetes Version: 1.11.6
> Prometheus Version: 2.4.3
>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/676d9124-07a5-4136-a451-f6c588a4fa93%40googlegroups.com.


--
(o- Julien Pivotto
//\ Open-Source Consultant
V_/_ Inuits - https://www.inuits.eu
signature.asc

Julien Pivotto

unread,
Mar 4, 2020, 3:35:35 PM3/4/20
to Aditya Nageswar, Prometheus Users
On 04 Mar 21:33, Julien Pivotto wrote:
> On 04 Mar 12:01, Aditya Nageswar wrote:
> >
> >
> > What happened?
> > Cannot merge queries for time based functions
> >
> > To Filter from 1:00 to 18:30, used the below query
> >
> > (vector(1) and ((hour() >= 01) and ((hour() <= 18) and (minute() <= 30 ))
> > )) or (vector(0))
>
> vector(1) and (hour() >= 01 and hour() <= 18) or ( hour() == 18 and
> minute() <= 30) or vector(0)


Sorry,


vector(1) and ((hour() >= 01 and hour() < 18) or ( hour() == 18 and
minute() <= 30)) or vector(0)


>
>
> >
> > This gave result as,
> > [image: image]
> > <https://user-images.githubusercontent.com/30234760/75909044-4e86e480-5e71-11ea-9cd2-6a271f10fff1.png>
> >
> > Did you expect to see something different?
> >
> > The query should be giving vector 1 from 1:00 to 18:30, Instead Filters
> > time for every 30 mins,
> >
> > As an alternative tried the below query which doesn`t help,
> >
> > (vector(1) and ((hour() >= 01) and (hour() <= 18.5) )) or (vector(0))
> >
> > Environment
> >
> > Kubernetes Version: 1.11.6
> > Prometheus Version: 2.4.3
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/676d9124-07a5-4136-a451-f6c588a4fa93%40googlegroups.com.
>
>
> --
> (o- Julien Pivotto
> //\ Open-Source Consultant
> V_/_ Inuits - https://www.inuits.eu
>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/20200304203338.GA20536%40oxygen.
signature.asc

Aditya Nageswar

unread,
Mar 5, 2020, 1:40:58 AM3/5/20
to Prometheus Users
Thanks Julien
Reply all
Reply to author
Forward
0 new messages