On Thu, 13 Jan 2022 at 20:29, Matthias Rampke <matth...@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.cand...@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-users+unsubscr...@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-users+unsubscr...@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-users+unsubscr...@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.

Reply via email to