Skip to content

Commit

Permalink
[ML] fix alert instance key for the single metric job (elastic#93442) (
Browse files Browse the repository at this point in the history
…elastic#93467)

Co-authored-by: Dima Arnautov <[email protected]>
  • Loading branch information
kibanamachine and darnautov authored Mar 3, 2021
1 parent b823a8c commit ad75625
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion x-pack/plugins/ml/server/lib/alerts/alerting_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit ad75625

Please sign in to comment.