Hi Gautam, I believe you're correct. Since the grouping is determined on a
(sub)route level, having a top-level switch on the "group" label and then
duplicating things below that seems to be the best way to achieve this.

On Tue, Jun 27, 2023 at 8:05 AM 'Gautam Gupta' via Prometheus Users <
[email protected]> wrote:

> Hi,
> Is there a way to default to the behavior of `group_by: ["..."]` (i.e. no
> grouping) while configuring an optional label to act as a "grouping" key?
>
> Maybe a better way to phrase is is that I'd like `group_by: ["alertname",
> "group"]` to group alerts by the `group` label when it is present, but to
> treat alerts as distinct if the label is not present.
>
> I think right now my only workaround is to duplicate my receivers to have
> separate `group_by` configs, and then route to them depending on the
> presence of the `group` label.
>
> The use case is that for most of my alerts, I'd like to be notified for
> each distinct occurrence, but a few of them are likely to fire across the
> entire fleet at once and I'd like those to be grouped together. Not sure if
> there's another way to accomplish this.
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/5f1dced4-13ca-45b8-9dca-04ad891b10f5n%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/5f1dced4-13ca-45b8-9dca-04ad891b10f5n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Julius Volz
PromLabs - promlabs.com

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CAObpH5yB20uOLrvZ-gfvwNfjJdHDsvRvvWF9JCOf6WE1J2bLmg%40mail.gmail.com.

Reply via email to