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 4db16f5243d1b..2e51d2e8291b5 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 @@ -73,7 +73,7 @@ export const createInventoryMetricThresholdExecutor = (libs: InfraBackendLibs) = fields: { [ALERT_REASON]: reason, [ALERT_RULE_PARAMETERS]: params as any, // the type assumes the object is already flattened when writing the same way as when reading https://github.com/elastic/kibana/blob/main/x-pack/plugins/rule_registry/common/field_map/runtime_type_from_fieldmap.ts#L60 - ...additionalContext + ...additionalContext, }, }); @@ -185,7 +185,7 @@ export const createInventoryMetricThresholdExecutor = (libs: InfraBackendLibs) = if (reason) { const actionGroupId = nextState === AlertStates.WARNING ? WARNING_ACTIONS.id : FIRED_ACTIONS.id; - + const additionalContext = results && results.length > 0 ? results[0][group].context : null; const alert = alertFactory(group, reason, additionalContext); diff --git a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/lib/get_data.ts b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/lib/get_data.ts index 74a9d25f70be9..264e0b365fc9c 100644 --- a/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/lib/get_data.ts +++ b/x-pack/plugins/infra/server/lib/alerting/inventory_metric_threshold/lib/get_data.ts @@ -23,9 +23,9 @@ interface BucketKey { node: string; } -type AdditionalContext = { +interface AdditionalContext { [x: string]: any; -}; +} type Response = Record< string, diff --git a/x-pack/test/api_integration/apis/metrics_ui/inventory_threshold_alert.ts b/x-pack/test/api_integration/apis/metrics_ui/inventory_threshold_alert.ts index 1f19896e4a192..077d362960259 100644 --- a/x-pack/test/api_integration/apis/metrics_ui/inventory_threshold_alert.ts +++ b/x-pack/test/api_integration/apis/metrics_ui/inventory_threshold_alert.ts @@ -109,7 +109,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: { eventId: 'event-0', groupId: 'group-0' }, tags: undefined, - } + }, }, }); }); @@ -140,7 +140,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: { eventId: 'event-0', groupId: 'group-0' }, tags: undefined, - } + }, }, }); }); @@ -180,7 +180,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: undefined, tags: undefined, - } + }, }, 'host-1': { metric: 'rx', @@ -201,7 +201,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: undefined, tags: undefined, - } + }, }, }); }); @@ -237,7 +237,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: undefined, tags: undefined, - } + }, }, 'host-1': { metric: 'rx', @@ -258,7 +258,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: undefined, tags: undefined, - } + }, }, }); }); @@ -295,7 +295,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: undefined, tags: undefined, - } + }, }, 'host-1': { metric: 'rx', @@ -316,7 +316,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: undefined, tags: undefined, - } + }, }, }); }); @@ -369,7 +369,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: { eventId: 'event-0', groupId: 'group-0' }, tags: undefined, - } + }, }, 'host-1': { metric: 'custom', @@ -397,7 +397,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: { eventId: 'event-1', groupId: 'group-0' }, tags: undefined, - } + }, }, }); }); @@ -446,7 +446,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: { eventId: 'event-0', groupId: 'group-0' }, tags: undefined, - } + }, }, 'host-1': { metric: 'custom', @@ -474,7 +474,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: { eventId: 'event-1', groupId: 'group-0' }, tags: undefined, - } + }, }, }); }); @@ -514,7 +514,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: { eventId: 'event-0', groupId: 'group-0' }, tags: undefined, - } + }, }, 'host-1': { metric: 'logRate', @@ -535,7 +535,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: { eventId: 'event-1', groupId: 'group-0' }, tags: undefined, - } + }, }, }); }); @@ -572,7 +572,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: { eventId: 'event-0', groupId: 'group-0' }, tags: undefined, - } + }, }, 'host-1': { metric: 'logRate', @@ -593,7 +593,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: { eventId: 'event-1', groupId: 'group-0' }, tags: undefined, - } + }, }, }); }); @@ -634,7 +634,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: undefined, tags: undefined, - } + }, }, 'ed01e3a3-4787-42f6-b73e-ac9e97294e9d': { metric: 'rx', @@ -655,7 +655,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: undefined, tags: undefined, - } + }, }, }); }); @@ -693,7 +693,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: undefined, tags: undefined, - } + }, }, 'ed01e3a3-4787-42f6-b73e-ac9e97294e9d': { metric: 'rx', @@ -714,7 +714,7 @@ export default function ({ getService }: FtrProviderContext) { orchestrator: undefined, labels: undefined, tags: undefined, - } + }, }, }); });