Azure Functions Notification

I have timer Azure Functions running in production, but now I want to be notified if the function is not working.

In my case, accessing various connected services can lead to crashes and there are many ways to troubleshoot. Failure is the type of error for which I need notification.

When the feature fails, the log entry indicates a failure, so I wonder if there is a hook in the system that would allow me to force the system to generate a notification.

I know that blob and queue bindings, for example, support the creation of poison queue entries, but binding a timer trigger doesn't say anything about any output of this kind.

I see that functions can pass their return status as input to other functions, but this operation is not explained in detail in the docs. Also, in this case I need to write another function to handle the error condition and I was looking for something built in.

I asked @AzureSupport about this, but their answer had nothing to do with Azure Functions, instead referenced DLL notification boxes and then recommended the file to me on uservoice.

I'm sure there must be people here who have implemented some kind of error status notification. I prefer a solution that doesn't require any code.

+7


source to share


5 answers


The recommended way to monitor and alert for failures is to use AppInsights, which now fully integrates with Azure Functions.

https://blogs.msdn.microsoft.com/appserviceteam/2017/04/06/azure-functions-application-insights/



Since all logs are available in AppInsights, it's easy to track crashes and set up alerts based on your own criteria.

However, if you only care about alerting, not how monitoring, etc., you can use Azure Monitor instead: https://docs.microsoft.com/en-us/azure/monitoring-and- diagnostics / monitoring-get-started

+3


source


When the feature fails, the log entry indicates a failure, so I wonder if there is a hook in the system that would allow me to force the system to generate a notification.

...

I prefer a solution that doesn't require any code.



This is a zero-code solution:

I have clicked @AzureFunctions once on this thread and the suggested answer was to use Application Insights. It can handle crash alerts as well as use Web sites.

Refer to the Azure Functions App-Insights documentation on how to link your functional app to App Insights. Then set up any alerts you want.

+2


source


Unfortunately, this hook doesn't exist.

Is it possible to switch from a timer trigger to a queue trigger?

You can get retries (if you like) and after the specified number of retries, the message is sent to the poison queue.

To schedule execution, you can add visibility timeout queue messages according to your schedule.

+1


source


To receive crash warnings, you have two options:

  • The timer is started than scanning the execution logs (via SFTP) for failures.
  • Wrap the entire function in a try / catch block and in the catch block, write a few lines to send you an email with error details.

Hope it helps.

0


source


No code:

  1. Go to your Azure Cloud account

  2. From the menu select "Monitor"

  3. Then select Add New Rule

  4. Then select your state, action and add alert details.

0


source







All Articles