Getting Started
Architecture
NServiceBus
Transports
Persistence
Hosting
ServiceInsight
ServicePulse
ServiceControl
Monitoring
Modernization
Samples

Observability

Component: IBM MQ Transport

The IBM MQ transport instruments send, receive, and dispatch operations using System.Diagnostics.Activity, following the OpenTelemetry messaging semantic conventions. This enables consistent tracing and monitoring across your messaging infrastructure.

Activity source

The transport emits activities under the activity source named NServiceBus.Transport.IBMMQ. Register this source with the OpenTelemetry tracer provider to collect and export transport-level traces for monitoring and diagnostics:

builder.Services.AddOpenTelemetry()
    .WithTracing(tracing => tracing
        .AddSource("NServiceBus.Transport.IBMMQ")
        .AddOtlpExporter());

Activities

The following activities are created for each transport operation. The Kind field indicates the activity's role in the messaging flow:

  • Consumer: Receiving messages from the transport
  • Producer: Sending or publishing messages
  • Internal: Internal processing operations
Activity nameKindDisplay name
NServiceBus.Transport.IBMMQ.ReceiveConsumerreceive {queueName}
NServiceBus.Transport.IBMMQ.DispatchInternaldispatch
NServiceBus.Transport.IBMMQ.PutToQueueProducersend {destination}
NServiceBus.Transport.IBMMQ.PutToTopicProducerpublish {topicName}
NServiceBus.Transport.IBMMQ.AttemptInternal(unnamed)

The Attempt activity wraps each processing attempt inside the immediate retry loop. It records failure details when message processing raises an exception.

NServiceBus core links its receive pipeline activity to the transport Receive activity. This creates a complete trace from message dequeue through handler execution.

Tags

Activities are tagged with contextual information used for filtering, querying, and analyzing traces.

Standard messaging tags

These tags follow the OpenTelemetry messaging semantic conventions:

TagActivitiesValue
messaging.systemAllibm_mq
messaging.destination.nameReceive, PutToQueue, PutToTopicQueue or topic name
messaging.operation.typeReceive, PutToQueue, PutToTopicreceive, send, or publish
messaging.message.idPutToQueue, PutToTopicNative MQ message ID as a hex string
messaging.batch.message_countDispatchTotal number of outgoing operations in the batch

Vendor-specific tags

TagActivitiesValue
nservicebus.transport.ibmmq.topic_stringPutToTopicThe IBM MQ topic string used to open the topic
nservicebus.transport.ibmmq.failure_countReceive, AttemptNumber of processing failures for the current message

Activity events

The following events are added to the active receive activity when a transaction outcome is recorded:

EventWhen
mq.commitTransaction committed successfully
mq.backoutTransaction backed out (message returned to queue)

Error status

When an operation fails, the activity status is set to Error with the exception message as the description. This applies to Receive, Dispatch, PutToQueue, PutToTopic, and Attempt activities.

Related Articles

  • OpenTelemetry
    Observability of NServiceBus endpoints with OpenTelemetry.