-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[APM]: Replace error occurrence watchers with Kibana Alerting
- Loading branch information
1 parent
17383b8
commit c6b3361
Showing
12 changed files
with
472 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export const ERROR_OCCURRENCE_ALERT_TYPE_ID = 'apm.error_occurrence'; | ||
export const NOTIFICATION_EMAIL_ACTION_ID = 'apm.notificationEmail'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...pm/public/components/app/ServiceDetails/ServiceIntegrations/createErrorOccurrenceAlert.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { APMClient } from '../../../../services/rest/createCallApmApi'; | ||
|
||
export interface Schedule { | ||
interval: string; | ||
} | ||
|
||
interface Arguments { | ||
callApmApi: APMClient; | ||
email: string; | ||
serviceName: string; | ||
slackUrl: string; | ||
threshold: number; | ||
timeRange: { | ||
value: number; | ||
unit: string; | ||
}; | ||
} | ||
|
||
export async function createErrorOccurrenceAlert({ | ||
callApmApi, | ||
email, | ||
serviceName, | ||
slackUrl, | ||
threshold, | ||
timeRange | ||
}: Arguments) { | ||
return callApmApi({ | ||
pathname: '/api/apm/alerts/error_occurrence', | ||
method: 'POST', | ||
params: { | ||
body: { | ||
serviceName, | ||
threshold, | ||
interval: `${timeRange.value}${timeRange.unit}`, | ||
actions: { | ||
email, | ||
slack: slackUrl | ||
} | ||
} | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.