I have an Azure Monitor alert on a custom metric with a filter. Here's what the Custom Log Query looks like:
customMetrics
| where name == 'MyMetricName'
| where cloud_RoleInstance == 'MyInstanceName'
| summarize AggregatedValue = sum(valueCount) by bin(timestamp, 5m)
I want to be alerted when sum(valueCount) == 0. For that, i specify "Metric measurement" => "Less than" => 1. This works fine as soon as the service emitting the metric is running. When it stops, there is no metrics and the query above would not return any records - that's the way aggregation functions work in Kusto. And because of that, the alert would never fire :(. Any ideas how to make it to?