Commit Graph

8 Commits

Author SHA1 Message Date
Koki Kato b9aae07a73 Check silence matching with Protobuf models
Signed-off-by: Koki Kato <koki.kato1994@gmail.com>

To support negative matchers.
2021-02-09 22:53:00 +09:00
Koki Kato 72ce7fd71f api: add test for gettableSilenceMatchesFilterLabels
Signed-off-by: Koki Kato <koki.kato1994@gmail.com>
2021-02-09 22:07:15 +09:00
Victor Araujo 846c04e807
Make filter labels consistent with Prometheus (#2403)
* Make filter labels consistent with Prometheus

Filtering the alert out when the label is missing precludes a
possible match for an empty value. This change allows the
match to be evaluated.

Closes #2342

Signed-off-by: Victor Araujo <vear91@gmail.com>

* Add tests for matchFilterLabels in v2 api

Signed-off-by: Victor Araujo <vear91@gmail.com>
2020-11-06 11:26:32 +01:00
Simon Pasquier e347c31ab6
api/v2: return empty array of peers when disabled (#2203)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2020-03-10 15:47:43 +01:00
Simon Pasquier 98a604efa7
api/v2: fix alerts with multiple receivers (#1948)
Signed-off-by: Simon Pasquier <spasquie@redhat.com>
2019-07-03 16:34:54 +02:00
Paul Gier 3ffe6cfdc8 api/v2: sort silences similarly to v1 api (#1786)
* api/v2: sort silences similarly to v1 api

Sort the queried silences to match behaviour in the v1 api.

Sort silences in-place instead of creating multiple slices.
Use separate function for sorting silences for easier testing.
Add unit test for sort order.

Signed-off-by: Paul Gier <pgier@redhat.com>
2019-03-11 14:19:52 +01:00
Max Leonard Inden 8e157b3af5
api/v2: Make cluster status peers and name optional
If a users chooses to disable the Alertmanager cluster feature, there is
no cluster name nor cluster peers. Hence these should be optional. Only
cluster status is set to "disabled".

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2019-02-04 11:40:30 +01:00
Max Leonard Inden 2f055d9966
api/v2: Do not populate cluster info if clustering is disabled
When users start Alertmanager with `--cluster.listen-address=`, the
cluster will not be initialized, hence api.peer will be `nil`. So far
this would result in a nil pointer dereference by the API v2 accessing
the api.peer field.

With this patch, api v2 skips populating the peers array, sets the name
to an empty string and the status to "disabled" in case `api.peer` is
nil.

Signed-off-by: Max Leonard Inden <IndenML@gmail.com>
2019-01-31 16:56:59 +01:00