[Metrics UI] Disable recovery action scheduling (#87061)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Zacqary Adam Xeper 2021-01-06 15:45:45 -06:00 committed by GitHub
parent ab944b4af0
commit 6df7498a41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 10 deletions

View file

@ -24,7 +24,7 @@ import {
buildErrorAlertReason,
buildFiredAlertReason,
buildNoDataAlertReason,
buildRecoveredAlertReason,
// buildRecoveredAlertReason,
stateToAlertMessage,
} from '../common/messages';
import { evaluateCondition } from './evaluate_condition';
@ -99,9 +99,14 @@ export const createInventoryMetricThresholdExecutor = (libs: InfraBackendLibs) =
.map((result) => buildReasonWithVerboseMetricName(result[item], buildFiredAlertReason))
.join('\n');
} else if (nextState === AlertStates.OK && prevState?.alertState === AlertStates.ALERT) {
reason = results
.map((result) => buildReasonWithVerboseMetricName(result[item], buildRecoveredAlertReason))
.join('\n');
/*
* Custom recovery actions aren't yet available in the alerting framework
* Uncomment the code below once they've been implemented
* Reference: https://github.com/elastic/kibana/issues/87048
*/
// reason = results
// .map((result) => buildReasonWithVerboseMetricName(result[item], buildRecoveredAlertReason))
// .join('\n');
}
if (alertOnNoData) {
if (nextState === AlertStates.NO_DATA) {

View file

@ -6,7 +6,7 @@
import { createMetricThresholdExecutor, FIRED_ACTIONS } from './metric_threshold_executor';
import { Comparator, AlertStates } from './types';
import * as mocks from './test_mocks';
import { RecoveredActionGroup } from '../../../../../alerts/common';
// import { RecoveredActionGroup } from '../../../../../alerts/common';
import {
alertsMock,
AlertServicesMock,
@ -21,7 +21,7 @@ interface AlertTestInstance {
state: any;
}
let persistAlertInstances = false;
let persistAlertInstances = false; // eslint-disable-line prefer-const
const mockOptions = {
alertId: '',
@ -366,6 +366,13 @@ describe('The metric threshold alert type', () => {
});
});
/*
* Custom recovery actions aren't yet available in the alerting framework
* Uncomment the code below once they've been implemented
* Reference: https://github.com/elastic/kibana/issues/87048
*/
/*
describe('querying a metric that later recovers', () => {
const instanceID = '*';
const execute = (threshold: number[]) =>
@ -410,6 +417,7 @@ describe('The metric threshold alert type', () => {
expect(getState(instanceID).alertState).toBe(AlertStates.OK);
});
});
*/
describe('querying a metric with a percentage metric', () => {
const instanceID = '*';

View file

@ -12,7 +12,7 @@ import {
buildErrorAlertReason,
buildFiredAlertReason,
buildNoDataAlertReason,
buildRecoveredAlertReason,
// buildRecoveredAlertReason,
stateToAlertMessage,
} from '../common/messages';
import { createFormatter } from '../../../../common/formatters';
@ -77,9 +77,14 @@ export const createMetricThresholdExecutor = (
.map((result) => buildFiredAlertReason(formatAlertResult(result[group])))
.join('\n');
} else if (nextState === AlertStates.OK && prevState?.alertState === AlertStates.ALERT) {
reason = alertResults
.map((result) => buildRecoveredAlertReason(formatAlertResult(result[group])))
.join('\n');
/*
* Custom recovery actions aren't yet available in the alerting framework
* Uncomment the code below once they've been implemented
* Reference: https://github.com/elastic/kibana/issues/87048
*/
// reason = alertResults
// .map((result) => buildRecoveredAlertReason(formatAlertResult(result[group])))
// .join('\n');
}
if (alertOnNoData) {
if (nextState === AlertStates.NO_DATA) {