The .NET Agent automatically detects Azure Service Bus backends when an instrumented tier makes a call to Azure Service Bus. The agent supports client library Azure.Messaging.ServiceBus version 7.0.0 and later.

Azure Service Bus exit points are methods that send or publish messages to queue or topic. Azure Service Bus entry points are methods that receive messages from a queue or a topic. The agent supports queue correlation from a sender exit call to a receiver entry point.

If you are using NServiceBus over the Azure Service Bus transport, see NServiceBus Backends for .NET.


Exit Points and Backend Naming

The agent discovers an Azure Service Bus backend exit point when a downstream application sends or publishes a message or a batch of messages to a queue or a topic.

The agent identifies a backend with the following properties:

  • Address: URI address to the Azure Service Bus Server. For example, //myservicebusname.servicebus.windows.net/.
  • Host: Host of the Azure Service Bus Server. For example, myservicebusname.servicebus.windows.net.
  • Path: Name of the queue or the topic where the message is sent or published. For example, myqueuename.

The agent names the backend as Address/Path. For example, amqps://myservicebusname.servicebus.windows.net/myqueuename.

Entry Points

The agent discovers Azure Service Bus entry point when an upstream application receives a message from a queue or a topic. The Agent names the entry point as Address/Path, similar to backend.

The Agent supports the ServiceBusProcessor Message Handler receiving pattern.

ServiceBusProcessor Message Handler

The agent detects the below pattern where the application processes an incoming message using a message handler configured using ServiceBusProcessor. In this case, the call timing reflects the execution time of the entire handler. The agent also detects the exit calls made within the handler.

ServiceBusProcessor example

ServiceBusClient client = ...;
string queueName = ...;
await using ServiceBusProcessor processor = client.CreateProcessor(queueName);
processor.ProcessMessageAsync += args =>
{
    Console.WriteLine($"Message Received: {args.Message.Body}");
    // more logic if needed
};
C#

Other Patterns

The agent detects an entry point when an application calls ServiceBusReceiver.CompleteMessageAsync(ServiceBusReceivedMessage,CancellationToken) which can be used in other receiving patterns. However in this case the call timing reflects only the time spent on completing a message. The agent does not detect exit calls while handling the message for this pattern.