From 49016994ac2497ab476fd3444f8579124513c1a4 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Fri, 19 Mar 2021 18:19:12 +0100 Subject: [PATCH] Switch to alertmanager api v2 According to the 2.25 release notes, 2.26 should switch to alertmanager api v2 by default. Signed-off-by: Julien Pivotto --- config/config.go | 2 +- config/config_test.go | 2 +- docs/configuration/configuration.md | 2 +- notifier/notifier_test.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/config.go b/config/config.go index 792ef5c1b..419c26a94 100644 --- a/config/config.go +++ b/config/config.go @@ -117,7 +117,7 @@ var ( DefaultAlertmanagerConfig = AlertmanagerConfig{ Scheme: "http", Timeout: model.Duration(10 * time.Second), - APIVersion: AlertmanagerAPIVersionV1, + APIVersion: AlertmanagerAPIVersionV2, HTTPClientConfig: config.DefaultHTTPClientConfig, } diff --git a/config/config_test.go b/config/config_test.go index 61ef13ac8..b2ae0343f 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -785,7 +785,7 @@ var expectedConf = &Config{ { Scheme: "https", Timeout: model.Duration(10 * time.Second), - APIVersion: AlertmanagerAPIVersionV1, + APIVersion: AlertmanagerAPIVersionV2, HTTPClientConfig: config.DefaultHTTPClientConfig, ServiceDiscoveryConfigs: discovery.Configs{ discovery.StaticConfig{ diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 3173279a2..2684eadad 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -1755,7 +1755,7 @@ through the `__alerts_path__` label. [ timeout: | default = 10s ] # The api version of Alertmanager. -[ api_version: | default = v1 ] +[ api_version: | default = v2 ] # Prefix for the HTTP path alerts are pushed to. [ path_prefix: | default = / ] diff --git a/notifier/notifier_test.go b/notifier/notifier_test.go index 432e07f86..ea0b7b151 100644 --- a/notifier/notifier_test.go +++ b/notifier/notifier_test.go @@ -454,7 +454,7 @@ func TestReload(t *testing.T) { }, }, }, - out: "http://alertmanager:9093/api/v1/alerts", + out: "http://alertmanager:9093/api/v2/alerts", }, } @@ -504,7 +504,7 @@ func TestDroppedAlertmanagers(t *testing.T) { }, }, }, - out: "http://alertmanager:9093/api/v1/alerts", + out: "http://alertmanager:9093/api/v2/alerts", }, }