Skip to content

Commit cf28bfb

Browse files
[ML] fix alert instance key for the single metric job (#93442) (#93468)
Co-authored-by: Dima Arnautov <[email protected]>
1 parent 51bab14 commit cf28bfb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

x-pack/plugins/ml/server/lib/alerts/alerting_service.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ export function alertingServiceProvider(mlClient: MlClient, esClient: Elasticsea
258258
} else if (source.result_type === ANOMALY_RESULT_TYPE.RECORD) {
259259
const fieldName = getEntityFieldName(source);
260260
const fieldValue = getEntityFieldValue(source);
261-
alertInstanceKey += `_${source.detector_index}_${source.function}_${fieldName}_${fieldValue}`;
261+
const entity =
262+
fieldName !== undefined && fieldValue !== undefined ? `_${fieldName}_${fieldValue}` : '';
263+
alertInstanceKey += `_${source.detector_index}_${source.function}${entity}`;
262264
}
263265
return alertInstanceKey;
264266
};

0 commit comments

Comments
 (0)