Stream analytics scale logging

New Contributor



I have a requirement to auto scale a Stream Analytics Job based on CPU utilization. I tried using the out of the box utilization alerts, but this caused problems when the scale operation failed; it would never fire the scale operation again. I changed to a custom kusto query based on AzureMetrics. This works well, and also triggers the alerts every time it evaluates the query.


The problem is it triggers the alerts every time it evaluates the query, so also keeps firing scale down alerts when the Stream Analytics job is already scaled at 1. I am now looking into including the Stream Analytics scale logging in the query, to prevent the alert from firing when the Stream Analytics is already scaled at 1 and wants to scale down, or 120 and wants to scale up. There is logging I can use for this, under the JobScaling operation, but for some reason it never logs scale operations below 6, even though it frequently scaled down below 6.


Below is my current query:

| where OperationName == 'JobScaling' and TimeGenerated > startofday(datetime("2021-03-09")) and TimeGenerated < endofday(datetime("2021-04-09"))
| project TimeGenerated, OperationName, properties_s
| extend scaledTo= toint(split(parse_json(properties_s).Message, "'")[1])
| project-away OperationName, properties_s
| summarize min(scaledTo), max(scaledTo)

The output:


The current scale at 1; (it is frequently scaled at 1):



Is this a bug? Is there any other way to achieve my goal?

0 Replies