Skip to content

Commit

Permalink
[ML][Rules] Fixes deletion in Check interval input for anomaly detect…
Browse files Browse the repository at this point in the history
…ion rule (#193420)

## Summary

It was trying to parse `null` values.
After:

![image](https://github.com/user-attachments/assets/82d24663-a895-4ad4-bc01-fb76b883bc66)

Fixes [#190732](#190732)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
rbrtj and kibanamachine authored Sep 23, 2024
1 parent 9f67292 commit 65b7bf9
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,15 @@ export const ConfigValidator: FC<ConfigValidatorProps> = React.memo(
({ jobConfigs = [], alertInterval, alertParams, alertNotifyWhen, maxNumberOfBuckets }) => {
if (jobConfigs.length === 0) return null;

const alertIntervalInSeconds = parseInterval(alertInterval)!.asSeconds();
const alertIntervalInSeconds = parseInterval(alertInterval)?.asSeconds();

const lookbackIntervalInSeconds =
!!alertParams.lookbackInterval && parseInterval(alertParams.lookbackInterval)?.asSeconds();

const isAlertIntervalTooHigh =
lookbackIntervalInSeconds && lookbackIntervalInSeconds < alertIntervalInSeconds;
lookbackIntervalInSeconds &&
alertIntervalInSeconds &&
lookbackIntervalInSeconds < alertIntervalInSeconds;

const jobWithoutStartedDatafeed = jobConfigs
.filter((job) => job.datafeed_config.state !== DATAFEED_STATE.STARTED)
Expand All @@ -49,6 +51,7 @@ export const ConfigValidator: FC<ConfigValidatorProps> = React.memo(
const notifyWhenWarning =
alertNotifyWhen === 'onActiveAlert' &&
lookbackIntervalInSeconds &&
alertIntervalInSeconds &&
alertIntervalInSeconds < lookbackIntervalInSeconds;

const bucketSpanDuration = parseInterval(jobConfigs[0].analysis_config.bucket_span!);
Expand Down

0 comments on commit 65b7bf9

Please sign in to comment.