Add the ability to alert based on Analytics query
Current alert options only work with metrics.
Provide a simple alert mechanism based on any Analytics query. This could be as simple as requiring a custom query that returns two values: Filter Column and Filter Count.
Here is an example:
Query returns number of times a certain event/error code is returned along with a cloud_RoleInstance name. You limit your query based on whatever where conditions you want (timespan, customDimension, etc.)
When you set up the alert, you
1. pick the shared query. Some quick validation is done that correct fields are returned.
2. You can then set a threshold if the count is greater than x. Timespan would not be used.
This would make alerting considerably more useful for the way we expect our customers to use it.
This is now available! See https://azure.microsoft.com/en-us/blog/log-alerts-for-application-insights-preview/
I've created a related request more akin to specifically what I was talking about below (creating alerts based on a Shared Query): https://feedback.azure.com/forums/357324-application-insights/suggestions/34290235-add-ability-to-alert-based-off-shared-query
Actually, the links I provided below don't really solve the issue. You can alert on a query when you use the App Insights API and have the query as part of the URL. The URL you get when you export from a Shared Query is actually just a link to the Shared Query in the Analytics portal--its not giving you back json or anything like that.
I re-voted :) Being able to alert on a Shared Query would be very nice because it would allow you to keep the query in one place instead of embedding it in your alert definitions.
Curtis Swartzentruber commented
Certainly there are other ways to achieve this, but if they are going to expose an alerting method directly in App Insights the current implementation seems half-baked.
Another option is to run continuous export to Log Analytics and alert from there. We proved this out and it works (the alerting options in Log Analytics are far superior). But then you are paying extra to send data over there beyond what you are already paying for App Insights. So I still feel like adding this would make the App Insights alert feature much more useful.
I voted for this but then revoked my vote when I found something similar. You can set up export a Shared Query as a URL (https://feedback.azure.com/forums/357324-application-insights/suggestions/13739847-add-ability-to-share-queries-via-url) and then set up an alert calling that URL (https://docs.microsoft.com/en-us/azure/application-insights/app-insights-tutorial-alert) and validate on the result (I haven't tested this)
Eric Dupuis commented
There is currently a preview feature named "Scheduled Analytics" somewhat available that promises to solve this need. I wish the VSAI team were more responsive on this feature and more details were available for it. I've tried to get more details on it and implement it since April 2017 with little success.