Skip to content

Commit

Permalink
PMM-12284 Remove Alertmanager (#2614)
Browse files Browse the repository at this point in the history
* PMM-12284 Remove alertmanager

* PMM-12284 Remove alertmanager URL from settings

* PMM-12284 Fix api tests
  • Loading branch information
artemgavrilov authored Dec 5, 2023
1 parent 5d570ea commit b1a4941
Show file tree
Hide file tree
Showing 113 changed files with 637 additions and 9,486 deletions.
1 change: 0 additions & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ packages:
github.com/percona/pmm/managed/services/server:
interfaces:
agentsStateUpdater:
alertmanagerService:
checksService:
emailer:
grafanaClient:
Expand Down
4 changes: 0 additions & 4 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ release: ## Build release versions of all components

gen: clean ## Generate files
make gen-api
make gen-alertmanager
make clean_swagger

make -C agent gen
Expand Down Expand Up @@ -103,9 +102,6 @@ gen-api: ## Generate PMM API

bin/swagger-order --output=api/swagger/swagger-dev.json api/swagger/swagger-dev.json

gen-alertmanager: ## Generate Alertmanager client
bin/swagger generate client --model-package=ammodels --client-package=amclient --spec=api/alertmanager/openapi.yaml --target=api/alertmanager

clean_swagger:
find api -name '*.swagger.json' -print -delete

Expand Down
5 changes: 5 additions & 0 deletions agent/packages.dot
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ digraph packages {
"/agents/noop" -> "/agents";
"/agents/noop.test" -> "/agents/noop";
"/agents/postgres/pgstatmonitor" -> "/agents";
"/agents/postgres/pgstatmonitor" -> "/queryparser";
"/agents/postgres/pgstatmonitor.test" -> "/agents/postgres/pgstatmonitor";
"/agents/postgres/pgstatstatements" -> "/agents";
"/agents/postgres/pgstatstatements" -> "/agents/cache";
"/agents/postgres/pgstatstatements" -> "/agents/postgres/parser";
"/agents/postgres/pgstatstatements" -> "/queryparser";
"/agents/postgres/pgstatstatements.test" -> "/agents/postgres/pgstatstatements";
"/agents/process.test" -> "/agents/process";
"/agents/supervisor" -> "/agents";
Expand All @@ -38,9 +40,11 @@ digraph packages {
"/agents/supervisor" -> "/config";
"/agents/supervisor" -> "/tailog";
"/agents/supervisor.test" -> "/agents/supervisor";
"/client" -> "/client/cache";
"/client" -> "/client/channel";
"/client" -> "/config";
"/client" -> "/connectionuptime";
"/client" -> "/models";
"/client" -> "/runner";
"/client" -> "/runner/actions";
"/client" -> "/runner/jobs";
Expand All @@ -54,6 +58,7 @@ digraph packages {
"/commands" -> "/connectionchecker";
"/commands" -> "/connectionuptime";
"/commands" -> "/runner";
"/commands" -> "/serviceinfobroker";
"/commands" -> "/tailog";
"/commands" -> "/versioner";
"/connectionchecker" -> "/config";
Expand Down
4 changes: 0 additions & 4 deletions api-tests/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import (
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"

"github.com/percona/pmm/api/alertmanager/amclient"
inventoryClient "github.com/percona/pmm/api/inventorypb/json/client"
alertingClient "github.com/percona/pmm/api/managementpb/alerting/json/client"
backupsClient "github.com/percona/pmm/api/managementpb/backup/json/client"
Expand Down Expand Up @@ -193,13 +192,10 @@ func init() {
}

transport := Transport(BaseURL, *serverInsecureTLSF)
alertmanagerTransport := Transport(BaseURL, *serverInsecureTLSF)
alertmanagerTransport.BasePath = "/alertmanager/api/v2"
transport.Consumers["application/zip"] = runtime.ByteStreamConsumer()
inventoryClient.Default = inventoryClient.New(transport, nil)
managementClient.Default = managementClient.New(transport, nil)
serverClient.Default = serverClient.New(transport, nil)
amclient.Default = amclient.New(alertmanagerTransport, nil)
backupsClient.Default = backupsClient.New(transport, nil)
platformClient.Default = platformClient.New(transport, nil)
alertingClient.Default = alertingClient.New(transport, nil)
Expand Down
2 changes: 0 additions & 2 deletions api-tests/management/alerting/alerting_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ import (
// we don't enable or disable Alerting explicit in our tests since it is enabled by default through
// DISABLE_ALERTING env var.
func TestRulesAPI(t *testing.T) {
t.Parallel()

t.Parallel()
client := alertingClient.Default.Alerting

Expand Down
70 changes: 0 additions & 70 deletions api-tests/server/alertmanager_test.go

This file was deleted.

6 changes: 0 additions & 6 deletions api-tests/server/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,6 @@ func TestPermissions(t *testing.T) {
{userType: "editor", login: editor, apiKey: editorAPIKey, statusCode: 401},
{userType: "admin", login: admin, apiKey: adminAPIKey, statusCode: 200},
}},
{name: "alerts-default", url: "/alertmanager/api/v2/alerts", method: http.MethodGet, userCase: []userCase{
{userType: "default", login: none, statusCode: 401},
{userType: "viewer", login: viewer, apiKey: viewerAPIKey, statusCode: 401},
{userType: "editor", login: editor, apiKey: editorAPIKey, statusCode: 401},
{userType: "admin", login: admin, apiKey: adminAPIKey, statusCode: 200},
}},
{name: "platform-connect", url: "/v1/Platform/Connect", method: "POST", userCase: []userCase{
{userType: "default", login: none, statusCode: 401},
{userType: "viewer", login: viewer, apiKey: viewerAPIKey, statusCode: 401},
Expand Down
8 changes: 2 additions & 6 deletions api-tests/server/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ func restoreSettingsDefaults(t *testing.T) {
StandardInterval: "86400s",
RareInterval: "280800s",
},
DataRetention: "2592000s",
AWSPartitions: []string{"aws"},
RemoveAlertManagerURL: true,
RemoveAlertManagerRules: true,
DataRetention: "2592000s",
AWSPartitions: []string{"aws"},
},
Context: pmmapitests.Context,
})
Expand All @@ -72,8 +70,6 @@ func restoreSettingsDefaults(t *testing.T) {
assert.Equal(t, expectedSTTIntervals, res.Payload.Settings.SttCheckIntervals)
assert.Equal(t, "2592000s", res.Payload.Settings.DataRetention)
assert.Equal(t, []string{"aws"}, res.Payload.Settings.AWSPartitions)
assert.Equal(t, "", res.Payload.Settings.AlertManagerURL)
assert.Equal(t, "", res.Payload.Settings.AlertManagerRules)
}

func restoreCheckIntervalDefaults(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions api-tests/server/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ func TestDownloadLogs(t *testing.T) {
assert.NoError(t, err)

expected := []string{
"alertmanager.ini",
"alertmanager.log",
"clickhouse-server.log",
"client/list.txt",
"client/pmm-admin-version.txt",
Expand Down
Loading

0 comments on commit b1a4941

Please sign in to comment.