Re: [prometheus-users] Query with diivision

2020-07-06 Thread Альберт Александров
I suspected there is something wrong with labels. 

Thanks for your answer! That worked

понедельник, 6 июля 2020 г., 11:19:12 UTC+3 пользователь Aliaksandr 
Valialkin написал:
>
> Try the following query:
>
> (rules_job_count{cluster="loco-prod", status="failed"} + ignoring(status) 
> rules_job_count{cluster="loco-prod", status="cancelled"}) / 
> ignoring(status) rules_job_count{cluster="loco-prod", status="finished"}
>
> It instructs Prometheus to ignore the `status` label when performing the 
> addition and division operations. See more details about this at 
> https://prometheus.io/docs/prometheus/latest/querying/operators/#vector-matching
>
>
> On Mon, Jul 6, 2020 at 10:48 AM Альберт Александров  > wrote:
>
>>
>> Hi all!
>>
>>
>> Have such metrics:
>>
>>
>> [image: photo_2020-07-06_10-30-12.jpg]
>>
>> I would like to query:
>>
>> (rules_job_count{cluster="loco-prod", status="failed"} + 
>>> rules_job_count{cluster="loco-prod", status="cancelled"}) / 
>>> rules_job_count{cluster="loco-prod", status="finished"}
>>
>>
>> But this didn't work. At the same time this query works:
>>
>> rules_job_count{cluster="loco-prod", status="failed"} + 
>>> rules_job_count{cluster="loco-prod", status="failed"} 
>>
>>
>> Could you say please how to make the first query work?
>>
>> -- 
>> 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 promethe...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/prometheus-users/ac417564-df12-4627-8c09-2538c759a7c7o%40googlegroups.com
>>  
>> 
>> .
>>
>
>
> -- 
> Best Regards,
>
> Aliaksandr Valialkin, CTO VictoriaMetrics
>

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/c55aed6d-c578-4168-a7c3-80295e7be160o%40googlegroups.com.


Re: [prometheus-users] Query with diivision

2020-07-06 Thread Aliaksandr Valialkin
Try the following query:

(rules_job_count{cluster="loco-prod", status="failed"} + ignoring(status)
rules_job_count{cluster="loco-prod", status="cancelled"}) /
ignoring(status) rules_job_count{cluster="loco-prod", status="finished"}

It instructs Prometheus to ignore the `status` label when performing the
addition and division operations. See more details about this at
https://prometheus.io/docs/prometheus/latest/querying/operators/#vector-matching


On Mon, Jul 6, 2020 at 10:48 AM Альберт Александров 
wrote:

>
> Hi all!
>
>
> Have such metrics:
>
>
> [image: photo_2020-07-06_10-30-12.jpg]
>
> I would like to query:
>
> (rules_job_count{cluster="loco-prod", status="failed"} +
>> rules_job_count{cluster="loco-prod", status="cancelled"}) /
>> rules_job_count{cluster="loco-prod", status="finished"}
>
>
> But this didn't work. At the same time this query works:
>
> rules_job_count{cluster="loco-prod", status="failed"} +
>> rules_job_count{cluster="loco-prod", status="failed"}
>
>
> Could you say please how to make the first query work?
>
> --
> 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-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/ac417564-df12-4627-8c09-2538c759a7c7o%40googlegroups.com
> 
> .
>


-- 
Best Regards,

Aliaksandr Valialkin, CTO VictoriaMetrics

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAPbKnmBXZoVtuxBXJjJ3GDf7PvVEszx%3DF3kqo_rwxa7yNKNhtA%40mail.gmail.com.


[prometheus-users] Query with diivision

2020-07-06 Thread Альберт Александров



Hi all!


Have such metrics:


[image: photo_2020-07-06_10-30-12.jpg]

I would like to query:

(rules_job_count{cluster="loco-prod", status="failed"} + 
> rules_job_count{cluster="loco-prod", status="cancelled"}) / 
> rules_job_count{cluster="loco-prod", status="finished"}


But this didn't work. At the same time this query works:

rules_job_count{cluster="loco-prod", status="failed"} + 
> rules_job_count{cluster="loco-prod", status="failed"} 


Could you say please how to make the first query work?

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/ac417564-df12-4627-8c09-2538c759a7c7o%40googlegroups.com.