[ML] fix alert instance key for the single metric job (#93442)

This commit is contained in:
Dima Arnautov 2021-03-03 18:23:10 +01:00 committed by GitHub
parent a0881f90e2
commit a8d45e7457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -258,7 +258,9 @@ export function alertingServiceProvider(mlClient: MlClient, esClient: Elasticsea
} else if (source.result_type === ANOMALY_RESULT_TYPE.RECORD) {
const fieldName = getEntityFieldName(source);
const fieldValue = getEntityFieldValue(source);
alertInstanceKey += `_${source.detector_index}_${source.function}_${fieldName}_${fieldValue}`;
const entity =
fieldName !== undefined && fieldValue !== undefined ? `_${fieldName}_${fieldValue}` : '';
alertInstanceKey += `_${source.detector_index}_${source.function}${entity}`;
}
return alertInstanceKey;
};