Reputation: 520
I have an Azure Functions app that is running on a timer trigger that I don't expect to exceed the 10 minute timeout limit, but I would like to receive an alert in the unlikely event that the application runs longer than 10 minutes. Is this possible to do in Application Insights? I didn't see an alert trigger for this use case. In Application Insights there is a "Long dependency duration" in the Smart Detection settings where I can add an email and there's also a "Failure Anomalies" alert rule already set up. Will either of these alert me if a function is running longer than 10 minutes?
I'd also like an alert if an individual function instance encounters any type of exception. I can set this up myself in the Python code by wrapping my code in a try except block and emailing if an exception is caught, but it would be easier if this was possible in Application Insights.
Upvotes: 1
Views: 709
Reputation: 14093
You can go to your host.json of your function app,
and change it like this:
{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
},
"functionTimeout": "00:10:00"
}
Then, if your instance is running more than 10 minutes, it will throw out an error.
So you can go to the Application Insight of your function and and select like below:
You can set the action type as Email/EMS and give it your email address, then you will receive an email when the timetrigger is timeout.
Upvotes: 1