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
  • Loading branch information
darnautov authored Mar 3, 2021
1 parent a0881f9 commit a8d45e7
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 a8d45e7

Please sign in to comment.