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 1941ec6326ddb..02a116a42c7a0 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 @@ -19,7 +19,7 @@ import { buildErrorAlertReason, buildFiredAlertReason, buildNoDataAlertReason, - buildRecoveredAlertReason, + // buildRecoveredAlertReason, stateToAlertMessage, } from '../common/messages'; import { evaluateCondition } from './evaluate_condition'; @@ -84,9 +84,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 a1d6428f3b52b..18456e261452c 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 { AlertExecutorOptions } from '../../../../../alerts/server'; import { alertsMock, @@ -21,7 +21,7 @@ interface AlertTestInstance { state: any; } -let persistAlertInstances = false; +let persistAlertInstances = false; // eslint-disable-line prefer-const describe('The metric threshold alert type', () => { describe('querying the entire infrastructure', () => { @@ -344,6 +344,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[]) => @@ -387,6 +394,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 60790648d9a9b..e71d929d026ce 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 @@ -13,7 +13,7 @@ import { buildErrorAlertReason, buildFiredAlertReason, buildNoDataAlertReason, - buildRecoveredAlertReason, + // buildRecoveredAlertReason, stateToAlertMessage, } from '../common/messages'; import { createFormatter } from '../../../../common/formatters'; @@ -68,9 +68,14 @@ export const createMetricThresholdExecutor = (libs: InfraBackendLibs) => .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) {