Alert on Service Bus Queue Backlog using Azure Alerts
Azure alerts allow you to configure one or more conditions on a single resource which, when met, can trigger one or more action groups. The conditions available depend on the resource. The action groups can contain notifications and actions such as webhooks and logic app requests.
We can use these alerts on the TWA service bus queues to send notifications to select users when the active message count reaches a chosen threshold. These service buses, which are used to transfer data between functions in TWA, should be sending out their incoming messages as soon as they recieved them. Ideally the active message count would be in the single digits. In cases where they’re higher for a prolonged period of time it could be indicative of slow function execution times and a backlog of messages may be growing. In which case it might be useful to monitor the queue and, if it shows no sign of stabilising, to take appropriate action.
You can configure this all manually if you want, or you can use our optional arm template. This template can be used in an existing resource group with the link below.
![](/wp-content/uploads/2024/07/image-8.png)
This template creates an alert rule for each service bus queue, currently at 13. Each of these alerts are configured with different default threshold values depending on the expected throughput of the queue it’s monitoring. These are based on an active user count of around 200. The template also creates a single action group with an email notification to a chosen user, this action is applied to all alert rules. Both the alert rules and action group can be modified after deployment to suit your needs. Such as adjusting the threshold values or changing the actions notification.
When deploying this template there will be several parameters to configure. Most of which are the threshold values per service bus queue, but there will also be text input fields for the Name and Email Address of a user to recieve the alert. Only one can be configured at deployment but you can add more after by going to the service bus, Alerts in the left panel and then Manage Actions in the tabs at the top.
![](/wp-content/uploads/2024/07/image-9.png)
Alert on Function Excecution counts and times using Azure Alerts
Much like the alerts for Service buses we can also use these alerts on the TWA Functions and Storage accounts when excecution counts/times and when entity counts reaches a chosen threshold. These Functions, which process all data in TWA, should be excecuting quickly and consitently. Ideally execution time would be in the single digits. In cases where they’re higher for a prolonged period of time it could be indicative of Function errors or high network latency.
You can configure this all manually if you want, or you can use our optional arm template. This template can be used in an existing resource group with the link below.
![](/wp-content/uploads/2024/07/image-8.png)
This template creates 2 alert rules for each function, currently at 15, as well as an alert on the Storage account. Each of these alerts are configured with different default threshold values depending on the expected throughput of the function it’s monitoring. These are based on an acitive user count of around 200. The template also creates a single action group with an email notification to a chosen user, this action is applied to all alert rules. Both the alert rules and action group can be modified after deployment to suit your needs. Such as adjusting the threshold values or changing the actions notifcation.
When deploying this template there will be several parameters to configure. Most of which are the threshold values per function, but there will also be text input fields for the Name and Email Address of a user to recieve the alert. Only one can be configured at deployment but you can add more after by going to the functions, Alerts in the left panel and then Manage Actions in the tabs at the top. There will also be fields for each function name if their names have been configured via manual deployment, in most cases leaving them as “AutoGenerate” will use the names configured via our TWA arm deployment template.
![](/wp-content/uploads/2024/07/image-10-678x1024.png)