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 1a72feeba0913..99dfbe1f6bdbd 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 @@ -131,7 +131,7 @@ const setEvaluationResults = (response: Array>) => { }; // FAILING: https://github.com/elastic/kibana/issues/155534 -describe.skip('The metric threshold alert type', () => { +describe('The metric threshold alert type', () => { describe('querying the entire infrastructure', () => { afterAll(() => clearInstances()); const instanceID = '*'; @@ -1401,7 +1401,7 @@ describe.skip('The metric threshold alert type', () => { await execute(true); const recentAction = mostRecentAction(instanceID); expect(recentAction.action).toEqual({ - alertDetailsUrl: 'http://localhost:5601/app/observability/alerts/mock-alert-uuid', + alertDetailsUrl: '', alertState: 'NO DATA', group: '*', groupByKeys: undefined, 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 cfe7a9cf94924..26db822e9caf5 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 @@ -311,7 +311,9 @@ export const createMetricThresholdExecutor = (libs: InfraBackendLibs) => ); const evaluationValues = alertResults.reduce((acc: Array, result) => { - acc.push(result[group].currentValue); + if (result[group]) { + acc.push(result[group].currentValue); + } return acc; }, []); diff --git a/x-pack/plugins/observability/server/lib/rules/threshold/threshold_executor.test.ts b/x-pack/plugins/observability/server/lib/rules/threshold/threshold_executor.test.ts index 82d2e41b2c809..3756ebae184c2 100644 --- a/x-pack/plugins/observability/server/lib/rules/threshold/threshold_executor.test.ts +++ b/x-pack/plugins/observability/server/lib/rules/threshold/threshold_executor.test.ts @@ -1394,7 +1394,7 @@ describe.skip('The metric threshold alert type', () => { await execute(true); const recentAction = mostRecentAction(instanceID); expect(recentAction.action).toEqual({ - alertDetailsUrl: 'http://localhost:5601/app/observability/alerts/mock-alert-uuid', + alertDetailsUrl: '', alertState: 'NO DATA', group: '*', groupByKeys: undefined, @@ -1888,6 +1888,11 @@ const mockLibs: any = { prepend: (path: string) => path, }, logger, + config: { + thresholdRule: { + groupByPageSize: 10_000, + }, + }, }; const executor = createMetricThresholdExecutor(mockLibs); diff --git a/x-pack/plugins/observability/server/lib/rules/threshold/threshold_executor.ts b/x-pack/plugins/observability/server/lib/rules/threshold/threshold_executor.ts index 0d2ef03128077..d267bf68921ee 100644 --- a/x-pack/plugins/observability/server/lib/rules/threshold/threshold_executor.ts +++ b/x-pack/plugins/observability/server/lib/rules/threshold/threshold_executor.ts @@ -311,7 +311,9 @@ export const createMetricThresholdExecutor = ({ ); const evaluationValues = alertResults.reduce((acc: Array, result) => { - acc.push(result[group].currentValue); + if (result[group]) { + acc.push(result[group].currentValue); + } return acc; }, []);