Skip to content

Commit a8d45e7

Browse files
authoredMar 3, 2021
[ML] fix alert instance key for the single metric job (elastic#93442)
1 parent a0881f9 commit a8d45e7

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

+3-1
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)
Please sign in to comment.