I have a DataFactory with diagnostic setting activate and sending logs to a Log Analytics Workspace.
I want to create an alert that fires only once if an event trigger hasn't run after 9AM.
I think some query like this:
let StartTime =startofday(now());
let EndTime =now();
let CheckHour = 9;
ADFTriggerRun
| where ResourceId contains toupper("DataFactory_Name")
| where TriggerName == "Trigger_Name"
| where TimeGenerated > StartTime and TimeGenerated < EndTime
| extend Hour = datetime_part("hour", TimeGenerated)
| where Hour < CheckHour
But I see some problems if I set the following settings to the alert:
- Number of results less than 0
- Period = 30 minutes
- Frequency = 30 minutes
(If the trigger runs correctly) The alert will fire 18 times before 9AM.
(If the trigger doesn't run) The alert will fire 48 times in a day.
Is there some query to avoid this? Maybe with some if condition?