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
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
30 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies