From 9f420bb5ff35b804b7aeaf7e5b1c1dd5dc46e6ea Mon Sep 17 00:00:00 2001 From: Bena Kansara <69037875+benakansara@users.noreply.github.com> Date: Tue, 24 Sep 2024 16:59:35 +0200 Subject: [PATCH] [RCA] Fix equation for rule condition chart (#193689) Resolves https://github.com/elastic/kibana/issues/193688 (cherry picked from commit 913b6fed50cbbbc6e05811fa013311e98389e7d0) --- .../public/utils/investigation_item_helper.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/observability_solution/observability/public/utils/investigation_item_helper.ts b/x-pack/plugins/observability_solution/observability/public/utils/investigation_item_helper.ts index 5ffaa234b3d97..cddf3290ed370 100644 --- a/x-pack/plugins/observability_solution/observability/public/utils/investigation_item_helper.ts +++ b/x-pack/plugins/observability_solution/observability/public/utils/investigation_item_helper.ts @@ -22,12 +22,12 @@ const AggMappingForLens: Record = { const genLensEqForCustomThresholdRule = (criterion: MetricExpression) => { const metricNameResolver: Record = {}; - criterion.metrics.forEach( - (metric: CustomThresholdExpressionMetric) => - (metricNameResolver[metric.name] = `${ - AggMappingForLens[metric.aggType] ? AggMappingForLens[metric.aggType] : metric.aggType - }(${metric.field ? metric.field : metric.filter ? metric.filter : ''})`) - ); + criterion.metrics.forEach((metric: CustomThresholdExpressionMetric) => { + const metricFilter = metric.filter ? `kql='${metric.filter}'` : ''; + metricNameResolver[metric.name] = `${ + AggMappingForLens[metric.aggType] ? AggMappingForLens[metric.aggType] : metric.aggType + }(${metric.field ? metric.field : metricFilter})`; + }); let equation = criterion.equation ? criterion.equation