-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
48d34ab
commit f01d96d
Showing
10 changed files
with
442 additions
and
111 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
46 changes: 46 additions & 0 deletions
46
...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,46 @@ | ||
/* | ||
* 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 { callApmApi } from '../../../../services/rest/callApmApi'; | ||
|
||
export interface Schedule { | ||
interval: string; | ||
} | ||
|
||
interface Arguments { | ||
email: string; | ||
serviceName: string; | ||
slackUrl: string; | ||
threshold: number; | ||
timeRange: { | ||
value: number; | ||
unit: string; | ||
}; | ||
} | ||
|
||
export async function createErrorOccurrenceAlert({ | ||
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 | ||
} | ||
} | ||
} | ||
}); | ||
} |
Oops, something went wrong.