For alerting rules it doesn't really make any practical difference.  Yes, 
the alert rule evaluations within a group are handled sequentially rather 
than in parallel, but the alerts don't interfere with each other.  You can 
still have one firing but not the other, or both, or neither.

Where it matters is for recording rules, when one recording rule uses as 
its input the output of the preceding recording rule.

On Friday, 14 January 2022 at 21:16:13 UTC rashmira...@gmail.com wrote:

> Hi,
>
> so the list of rules in a group will execute sequentially but it throws an 
> alert when that particular alert rule condition is met.
> example:
> groups:
>   - name: grp1
>     rules:
>     - alert: A1
>
>       expr: histogram_quantile(.99, 
> sum(rate(http_server_requests_seconds_bucket{uri="<uri>",status="200",appName="app"}[5m]))
>  
> by (le,appName)) > bool 2
>       labels:
>         app_name: app
>       annotations:
>         summary: '(instance {{ $labels.instance }})'
>     - alert: A2
>
>       expr: up{job="springapp"} == 0
>       labels:
>         app_name: app
>       annotations:
>         summary: "app down alert"
>
> In the background, A1 is executed first and then A2 rule. but if the A1 
> condition has not been met, and A2 has met then an alert for A2 is thrown 
> irrespective of A1. is this correct?
>
> On Fri, Jan 14, 2022 at 2:02 AM Brian Brazil <
> brian....@robustperception.io> wrote:
>
>> On Thu, 13 Jan 2022 at 20:29, Matthias Rampke <matt...@prometheus.io> 
>> wrote:
>>
>>> Just to check my understanding: I think rules within one group are also 
>>> evaluated in order, while groups (even at the same interval) can be 
>>> evaluated concurrently.
>>>
>>> If you have multiple rules that build on top of one another (using the 
>>> output of one rule in the next) put them in one group, with the most basic 
>>> rule first and those that rely on it later. This ensures that each rule 
>>> sees current and complete data from those before it.
>>>
>>> On the other hand, if you have several rules that take a while to 
>>> evaluate, and independent, put them in separate groups. This allows 
>>> Prometheus to take advantage of multiple CPUs and I/O parallelism to make 
>>> sure that each group finishes evaluation within its interval.
>>>
>>> Do I remember this correctly?
>>>
>>
>> Yes, that's correct.
>>
>> Brian
>>  
>>
>>>
>>> /MR
>>>
>>> On Tue, Jan 11, 2022, 12:00 Brian Candler <b.ca...@pobox.com> wrote:
>>>
>>>> Not much.  The main thing is that all rules within a rule group have 
>>>> the same evaluation interval; so if you want to have a rule evaluated at a 
>>>> different interval, it must be in a different group.
>>>>
>>>> On Tuesday, 11 January 2022 at 04:22:10 UTC rashmira...@gmail.com 
>>>> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> can someone please help me understand with what is the difference 
>>>>> between using two different groups in rule.yml and using one group with 
>>>>> list of two rules?
>>>>> in which situation groups should be preferred and a list of rules in 
>>>>> one group?
>>>>> please find below for reference.
>>>>>
>>>>> groups:
>>>>>   - name: Spring-boot
>>>>>     rules:
>>>>>     - alert: response_time_mtr
>>>>>       expr: histogram_quantile(.99, 
>>>>> sum(rate(http_server_requests_seconds_bucket{uri="<uri>",status="200",appName="app"}[5m]))
>>>>>  
>>>>> by (le,appName)) > 2
>>>>>       labels:
>>>>>         app_name: app
>>>>>         group: Spring-boot
>>>>>       annotations:
>>>>>         summary: '(instance {{ $labels.instance }})'
>>>>>   - name: grp_2
>>>>>     rules:
>>>>>     - alert: up_mtr
>>>>>       expr: up{job="springapp"} == 0
>>>>>       labels:
>>>>>         app_name: app
>>>>>         group: grp_2
>>>>>       annotations:
>>>>>         summary: "app down alert"
>>>>>
>>>>> ------------------------------------
>>>>> groups:
>>>>>   - name: Spring-boot
>>>>>     rules:
>>>>>     - alert: response_time_mtr
>>>>>       expr: histogram_quantile(.99, 
>>>>> sum(rate(http_server_requests_seconds_bucket{uri="<uri>",status="200",appName="app"}[5m]))
>>>>>  
>>>>> by (le,appName)) > bool 2
>>>>>       labels:
>>>>>         app_name: app
>>>>>       annotations:
>>>>>         summary: '(instance {{ $labels.instance }})'
>>>>>     - alert: up_mtr
>>>>>       expr: up{job="springapp"} == 0
>>>>>       labels:
>>>>>         app_name: app
>>>>>       annotations:
>>>>>         summary: "app down alert"
>>>>> Thanks
>>>>>
>>>> -- 
>>>> 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/4f4d976b-925a-47b4-abe3-23eab9f6a0f5n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/prometheus-users/4f4d976b-925a-47b4-abe3-23eab9f6a0f5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>>> 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/CAMV%3D_gZ8z1cwNadwupa23D47%2Bg9auQy6dKRQDHT8YkuY6P1h6A%40mail.gmail.com
>>>  
>>> <https://groups.google.com/d/msgid/prometheus-users/CAMV%3D_gZ8z1cwNadwupa23D47%2Bg9auQy6dKRQDHT8YkuY6P1h6A%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> -- 
>> Brian Brazil
>> www.robustperception.io
>>
>> -- 
>> 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/CAHJKeLrBYmEFWO-LLmf%2BnMQJoswiqRAvA7_YEpeVxgxTfNpGHw%40mail.gmail.com
>>  
>> <https://groups.google.com/d/msgid/prometheus-users/CAHJKeLrBYmEFWO-LLmf%2BnMQJoswiqRAvA7_YEpeVxgxTfNpGHw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/64c06188-193f-4285-a3a0-b306f785e391n%40googlegroups.com.

Reply via email to