Skip to content

Commit

Permalink
PMM-12252 Removing Alertmanager from advisors dependencies (#1915)
Browse files Browse the repository at this point in the history
* PMM-11796 Remove alertmanager from Advisors flow

* PMM-11796 Deprecate some APIs

* PMM-11796 Cleanup AM leftovers, add positive advisors alerts

* PMM-11796 Remove unused code, fix bug

* PMM=-11796 Fix tests

* PMM-11796 Fix

* PMM-11796 Fix tests

* PMM-11796 Hit CI

* PMM-12252 Revert positive advisor insights

* Refactoring
  • Loading branch information
artemgavrilov authored Sep 4, 2023
1 parent 801f184 commit a0a5048
Show file tree
Hide file tree
Showing 18 changed files with 284 additions and 669 deletions.
184 changes: 92 additions & 92 deletions api/managementpb/checks.pb.go

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions api/managementpb/checks.proto
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,15 @@ service SecurityChecks {
}
// ToggleCheckAlert allows to switch alerts state for a check result between "silenced" and "unsilenced".
rpc ToggleCheckAlert(ToggleCheckAlertRequest) returns (ToggleCheckAlertResponse) {
option deprecated = true;
option (google.api.http) = {
post: "/v1/management/SecurityChecks/ToggleCheckAlert"
body: "*"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Toggle Check Alert"
description: "Silence/Unsilence alerts for a specific check result."
deprecated: true
};
}
// GetSecurityCheckResults returns Security Thread Tool's latest checks results.
Expand All @@ -223,6 +225,7 @@ service SecurityChecks {
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
summary: "Get Security Check Results"
description: "Returns Security Thread Tool's latest checks results."
deprecated: true
};
}
// StartSecurityChecks executes Security Thread Tool checks and returns when all checks are executed.
Expand Down
3 changes: 3 additions & 0 deletions api/managementpb/checks_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions api/managementpb/json/managementpb.json
Original file line number Diff line number Diff line change
Expand Up @@ -6365,6 +6365,7 @@
],
"summary": "Get Security Check Results",
"operationId": "GetSecurityCheckResults",
"deprecated": true,
"parameters": [
{
"name": "body",
Expand Down Expand Up @@ -6788,6 +6789,7 @@
],
"summary": "Toggle Check Alert",
"operationId": "ToggleCheckAlert",
"deprecated": true,
"parameters": [
{
"name": "body",
Expand Down
2 changes: 2 additions & 0 deletions api/swagger/swagger-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -29902,6 +29902,7 @@
],
"summary": "Get Security Check Results",
"operationId": "GetSecurityCheckResults",
"deprecated": true,
"parameters": [
{
"name": "body",
Expand Down Expand Up @@ -30325,6 +30326,7 @@
],
"summary": "Toggle Check Alert",
"operationId": "ToggleCheckAlert",
"deprecated": true,
"parameters": [
{
"name": "body",
Expand Down
2 changes: 2 additions & 0 deletions api/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -20529,6 +20529,7 @@
],
"summary": "Get Security Check Results",
"operationId": "GetSecurityCheckResults",
"deprecated": true,
"parameters": [
{
"name": "body",
Expand Down Expand Up @@ -20952,6 +20953,7 @@
],
"summary": "Toggle Check Alert",
"operationId": "ToggleCheckAlert",
"deprecated": true,
"parameters": [
{
"name": "body",
Expand Down
6 changes: 3 additions & 3 deletions managed/cmd/pmm-managed-starlark/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ func runChecks(l *logrus.Entry, data *checks.StarlarkScriptData) ([]check.Result
if !ok {
return nil, errors.Errorf("unexpected query result type: %T", dbQr)
}
if dbRes[dbName], err = unmarshallQueryResult(s); err != nil {
if dbRes[dbName], err = unmarshalQueryResult(s); err != nil {
return nil, err
}
}
res[i] = dbRes
case string: // used for all other databases
if res[i], err = unmarshallQueryResult(qr); err != nil {
if res[i], err = unmarshalQueryResult(qr); err != nil {
return nil, err
}
default:
Expand All @@ -158,7 +158,7 @@ func runChecks(l *logrus.Entry, data *checks.StarlarkScriptData) ([]check.Result
return results, nil
}

func unmarshallQueryResult(qr string) ([]map[string]any, error) {
func unmarshalQueryResult(qr string) ([]map[string]any, error) {
b, err := base64.StdEncoding.DecodeString(qr)
if err != nil {
return nil, errors.Wrap(err, "failed to decode base64 encoded query result")
Expand Down
3 changes: 1 addition & 2 deletions managed/cmd/pmm-managed/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,7 @@ func main() { //nolint:cyclop,maintidx
l.Fatalf("Could not create Clickhouse client: %s", err)
}

checksService := checks.New(db, platformClient, actionsService, alertManager, v1.NewAPI(vmClient), clickhouseClient)

checksService := checks.New(db, platformClient, actionsService, v1.NewAPI(vmClient), clickhouseClient)
prom.MustRegister(checksService)

// Integrated alerts services
Expand Down
Loading

0 comments on commit a0a5048

Please sign in to comment.