Alert to see if messages are stuck in Servicebus Queue during a particular time in a day

Rajesh Ambakkat 216 Reputation points
2022-11-30T16:01:00.7+00:00

I have a queue in my service bus and every day at 9am to 10 am I get 1000 messages. I have a function app which picks up the messages and processes them. So ideally after 11 am active messages count in the queue should be 0. But sometimes my function app stop processing them, and it get stuck forever. Is there a way to alert me to say the messages are not getting processed from the queue.

I tried the alerts in service bus, but it seems it monitor for the entire day... is there a way to say only for a particular time to monitor 9 to 11 am every day?

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,783 questions
Azure Service Bus
Azure Service Bus
An Azure service that provides cloud messaging as a service and hybrid integration.
542 questions
0 comments No comments
{count} votes

Accepted answer
  1. Maxim Sergeev 6,566 Reputation points Microsoft Employee
    2022-12-01T00:08:59.883+00:00

    Hi there,

    You can't configre the logic by using Azure metrics purely. To achieve the scenario, you need to ingest the metrics data to Log Analytics first via diagnostics settings.
    In the Log Analytics workspace, you will be able to correlate the data as required

    265886-image.png


1 additional answer

Sort by: Most helpful
  1. Anonymous
    2022-12-02T14:36:00.11+00:00

    Here is a link that shows how to do it using Azure CLI or Powershell https://learn.microsoft.com/en-us/azure/service-bus-messaging/message-counters . You could create a process that runs every couple of minutes during the period you are concerned about and sends you an alert.