New function join_label_sorted()

10 views
Skip to first unread message

D

unread,
Mar 12, 2020, 7:35:14 PM3/12/20
to prometheus...@googlegroups.com
Hi All,

I am interested in adding (or having) a new function join_label_sorted() which will be similar to join_label(). It is described as: 

For each timeseries in v, label_join_sorted(v instant-vector, dst_label, string, separator string, src_label1 string, src_label2 string...) joins all the values of all the src_labels using separator and returns the timeseries with the label dst_label contained the joined value such that joined value is concatenation of original values in sorted order. There can be any number of src_labels in this function. 

The following example will return a vector with each time series having a foo label with the value 7_9_12 added to it. 

label_join_sorted(up{job="api-server",src1="12",src2="7",src3="9"}, "foo", "_", "src1", "src2", "src3")

It will help me write alarming rules where I can do group by based on the composite label-value. I am not sure if we can achieve it today using UNLESS clause or so. Let me elaborate with an example to understand why this is a requirement. Let's consider that are two services or devices which are connected as follows:

     A------B 

Suppose the logical/physical connection between A or B goes down, metrics collected from/for each end-point can potentially trigger an alarm. Metric from A will generate an alarm with labels - local node is A and remote node is B. Metric from B will generate an alarm with swapped values. Since the underlying issue could be same, we don't want to generate both the alarms because JIRA fails to de-dup such issues more often than not. 


Thanks,
Dhiman


Ben Kochie

unread,
Mar 13, 2020, 4:26:42 AM3/13/20
to D, Prometheus Developers
Are you sure you're not looking for inhibit rules?


This allows one alert to inhibit another alert from firing.

--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CAB2OGjzJY8hHBUXWRsTqQ4EuDt4kFRSiordgfdS3BD1-S15-Tg%40mail.gmail.com.

Julien Pivotto

unread,
Mar 13, 2020, 4:28:53 AM3/13/20
to Ben Kochie, D, Prometheus Developers
I think alerting on min (up) by (instance,job) == 0 might work too in
this case.
> > <https://groups.google.com/d/msgid/prometheus-developers/CAB2OGjzJY8hHBUXWRsTqQ4EuDt4kFRSiordgfdS3BD1-S15-Tg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> > .
> >
>
> --
> You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/CABbyFmrDwLtXd0GSfNVOvL0%3D05P1-wwZA4FQZJCjM4BOd4Uppw%40mail.gmail.com.

--
(o- Julien Pivotto
//\ Open-Source Consultant
V_/_ Inuits - https://www.inuits.eu
signature.asc
Reply all
Reply to author
Forward
0 new messages