I have a premium service bus in Azure with a number of Queues. I can set max size for these, but I can't seem to find a way to alert the support team, via any route, but I would prefer email, if these queues exceed 1,000 messages in length, ie our consumers have fallen over or are not processing fast enough.
How can I set up some form of alerting for queue length on Azure service bus?
P.S. we still seem to be waiting for it to be implemented as a first class feature: https://feedback.azure.com/forums/231545-diagnostics-and-monitoring/suggestions/4486464-alerts-based-on-queue-size
You can access alerts for Azure Service Bus by selecting Alerts from the Azure Monitor section on the home page for your Service Bus namespace. See Create, view, and manage metric alerts using Azure Monitor for details on creating alerts.
Service Bus messaging services (queues and topics/subscriptions) allow application to send messages of size up to 256 KB (standard tier) or 100 MB (premium tier).
When the delivery count exceeds the limit, the message is moved to the DLQ. The dead-letter reason for the message in DLQ is set to: MaxDeliveryCountExceeded. This behavior can't be disabled, but you can set the max delivery count to a large number.
A queue message can be up to 64 KB in size. A queue may contain millions of messages, up to the total capacity limit of a storage account.
Traditionally, a solution was indeed to pull message counts using NamespaceManager
and report that value periodically. While it's an approach that works, there's another alternative that is emerging these days - Azure Monitor Service.
With this approach, unlike polling for data, Azure Service Bus is reporting to Monitor the metrics. Those metrics can be queried or alerts be created sending notifications to email addresses, webhook, or LogicApp. It's still fresh and in preview, but is shaping up nicely. For Azure Service Bus specifically, you can already get the metrics for a namespace and entity specific information should be available in a foreseeable future.
Update
I've raised an issue for Azure Service Bus you can track to see when it's available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With