Home

Standard Deviation in AppInsights query

sunnypatel
Occasional Visitor

I want to be able to get alerted from AppInsights whenever the number of errors in 15min time "buckets" exceeds 2 standard deviations from the norm. 

Here is an example of what I've tried thus far:

 

let x =
toscalar(customEvents
| where name contains "Vendor"
| where customDimensions.OperationResult != "Success"
| summarize RequestCount=count() by OperationResult=tostring(customDimensions.OperationResult), bin(timestamp, 15min)
| summarize stdev(RequestCount));

customEvents
| where name contains "Vendor"
| where customDimensions.OperationResult != "Success"
| summarize RequestCount=count() by OperationResult=tostring(customDimensions.OperationResult), bin(timestamp, 15min)
| where RequestCount >= (x * 2)
 
However this query errors with "'where' operator: Failed to resolve column or scalar expression named 'x'"
 
This seems like a pretty basic request for an analytics service so I'm sure I'm missing something here.
 
Thanks
1 Reply

The query seems to be fine.  You just have an extra blank link after completion of your let statement.

let x =
toscalar(customEvents
| where name contains "Vendor"
| where customDimensions.OperationResult != "Success"
| summarize RequestCount=count() by OperationResult=tostring(customDimensions.OperationResult), bin(timestamp, 15min)
| summarize stdev(RequestCount));
customEvents
| where name contains "Vendor"
| where customDimensions.OperationResult != "Success"
| summarize RequestCount=count() by OperationResult=tostring(customDimensions.OperationResult), bin(timestamp, 15min)
| where RequestCount >= (x * 2)
Related Conversations
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Early preview of Microsoft Edge group policies
Sean Lyndersay in Discussions on
65 Replies
*Updated 9/3* Syncing in Microsoft Edge Preview Channels
Elliot Kirk in Articles on
202 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
2 Replies