diff --git a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts index 54cf8658a3f0d..1b584f6306de9 100644 --- a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts +++ b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.ts @@ -23,7 +23,7 @@ import { buildErrorAlertReason, buildFiredAlertReason, buildNoDataAlertReason, - buildRecoveredAlertReason, + // buildRecoveredAlertReason, stateToAlertMessage, } from '../common/messages'; import { evaluateCondition } from './evaluate_condition'; @@ -96,9 +96,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) { diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts index 6c9fac9d1133c..31561a8f6b145 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.test.ts @@ -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 = '*'; diff --git a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.ts b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.ts index d63b42cd3b146..1b8e018659ee5 100644 --- a/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.ts +++ b/x-pack/plugins/infra/server/lib/alerting/metric_threshold/metric_threshold_executor.ts @@ -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) {