forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Response Ops][Alerting] Provide the latest alert payload on reportin…
…g an existing alert (elastic#174919) ## Summary Closes elastic#169631 - Updates the `report` method of the `AlertsClient` to optionally return the latest alert payload for reported alert instance - Updates the `kibana.alert.anomaly_score` field to an array type to preserve an anomaly score history ### Checklist - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- Loading branch information
Showing
12 changed files
with
211 additions
and
26 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
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
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
2 changes: 1 addition & 1 deletion
2
...plugins/alerting/server/integration_tests/__snapshots__/alert_as_data_fields.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
51 changes: 51 additions & 0 deletions
51
x-pack/plugins/ml/public/alerting/anomaly_detection_alerts_table/render_cell_value.test.tsx
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,51 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { EuiHealth } from '@elastic/eui'; | ||
import { type FieldFormatsRegistry } from '@kbn/field-formats-plugin/common'; | ||
import { fieldFormatsServiceMock } from '@kbn/field-formats-plugin/public/mocks'; | ||
import React from 'react'; | ||
import { ALERT_ANOMALY_SCORE } from '../../../common/constants/alerts'; | ||
import { getAlertFormatters } from './render_cell_value'; | ||
|
||
describe('getAlertFormatters', () => { | ||
const fieldFormatsMock = fieldFormatsServiceMock.createStartContract(); | ||
|
||
const alertFormatter = getAlertFormatters(fieldFormatsMock as FieldFormatsRegistry); | ||
|
||
test('format anomaly score correctly', () => { | ||
expect(alertFormatter(ALERT_ANOMALY_SCORE, 50.3)).toEqual( | ||
<EuiHealth color="#fba740" textSize="xs"> | ||
50 | ||
</EuiHealth> | ||
); | ||
|
||
expect(alertFormatter(ALERT_ANOMALY_SCORE, '50.3,89.6')).toEqual( | ||
<EuiHealth color="#fe5050" textSize="xs"> | ||
89 | ||
</EuiHealth> | ||
); | ||
|
||
expect(alertFormatter(ALERT_ANOMALY_SCORE, '0.7')).toEqual( | ||
<EuiHealth color="#d2e9f7" textSize="xs"> | ||
< 1 | ||
</EuiHealth> | ||
); | ||
|
||
expect(alertFormatter(ALERT_ANOMALY_SCORE, '0')).toEqual( | ||
<EuiHealth color="#d2e9f7" textSize="xs"> | ||
< 1 | ||
</EuiHealth> | ||
); | ||
|
||
expect(alertFormatter(ALERT_ANOMALY_SCORE, '')).toEqual( | ||
<EuiHealth color="#d2e9f7" textSize="xs"> | ||
< 1 | ||
</EuiHealth> | ||
); | ||
}); | ||
}); |
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
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
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