![[MQ 9.4.3 Jun 2025]](ng943.gif)
Span emission
If a message contains trace context then the OTELTRAC attribute on the queue manager, or on the queue, controls whether IBM® MQ emits a span when a message is sent to, or destructively received from, a queue.
- CICS®, IMS, RRS, JMS, or batch applications.
- Applications connected over a server-connection channel.
- The channel initiator moving messages over a sender-receiver channel, or via a cluster.
- The intra-group queuing agent.
- JMS delivery delay.
- When report messages are generated.
The OTELTRAC attribute
The OTELTRAC attribute can be configured on the queue manager, or on local, model or remote queues. By default all local, model or remote queues are configured with OTELTRAC(QMGR) which means that changing the OTELTRAC on the queue manager can enable, or disable trace for all queues.
- QMGR: the default, use the value of OTELTRAC from the queue manager.
- OFF: do not emit spans, even if messages contain trace context.
- ON: emit spans if messages contain trace context.
- OFF: do not emit spans, even if messages contain trace context.
- ON: emit spans if messages contain trace context.
- NONE: the queue manager never emits spans, even if OTELTRAC(ON) is specified on individual queues. Setting OTELTRAC(ON) on a queue results in the fast put to waiting getter optimization being disabled.
- OTELTRAC(QMGR)
How span emission works - when sending a message
When a message is sent to a queue which has OTELTRAC(ON) configured, then the queue manager checks the message to see if it contains trace context. If it does, and the message was successfully put to the queue then the queue manager generates a producer span containing information about the sending application, and the message that was sent. For a list of attributes that can be in a span, see Span attributes.
Spans for messages sent out of sync point are emitted by the queue manager immediately. Spans for messages that are sent in sync point are emitted when the current unit of work commits, or rolls back.
How span emission works - when receiving a message
- A span was emitted when the message was sent to a queue.
- OTELTRAC(NONE) is not set on the queue manager.
If both these criteria are met, then the queue manager generates a consumer span containing information about the receiving application, and the message that was received. For a list of attributes that can be in a span, see Span attributes.
Spans for messages received out of sync point are emitted by the queue manager immediately. Spans for messages that are received in sync point are emitted when the current unit of work commits, or rolls back.
Distributed queuing and clustering considerations
- If a remote queue definition is used for queue name resolution then the value of OTELTRAC on that queue applies, regardless of the value of OTELTRAC on the transmission queue.
- Otherwise the value of OTELTRAC on the transmission queue applies.
OTELTRAC is not a clustered attribute, to emit spans when messages are sent to a remote clustered queue requires that OTELTRAC(ON) is specified on the relevant cluster transmission queue.
Example configuration one
By default, the queue manager does not emit any spans even if messages contain trace context:
- The queue manager defaults to OTELTRAC(OFF).
- Queues default to OTELTRAC(OFF) for certain system queues, or OTELTRAC(QMGR) for user defined queues or certain system queues.
Example configuration two
Altering the queue manager to OTELTRAC(ON) means that any messages sent to the queue manager with trace context result in the queue manager emitting spans.
Example configuration three
If a local queue called APPLICATION.QUEUE.ONE was configured with OTELTRAC(ON), then any message sent to, or received from, that queue with trace context generates a span.
Example configuration four
- A producer span is emitted by MQA when APP1 sends the message to APP2.REQUEST.
- A consumer span is emitted by MQA when the channel initiator takes the message off the transmission queue prior to sending it over the channel.
- A producer span is emitted by MQB when the channel initiator receives the message and puts it to APP2.REQUEST.
- A consumer span is emitted by MQB when APP2 receives the message.
Example configuration five
- A producer span is emitted by MQC when APP3 sends the message to APP4.REQUEST.
- A consumer span is emitted by MQC when the MCA process takes the message off the transmission queue prior to sending it over the channel.
- A producer span is emitted by MQD when the channel initiator receives the message and puts it to APP4.REQUEST.
- A consumer span is emitted by MQD when APP4 receives the message.
When spans are not emitted
IBM MQ prioritizes the integrity of the queue manager over the emission of span data. If a span cannot be emitted for any reason, the span data is discarded. SMF data, either in the message manager, or per queue is collected to indicate the reasons for discarding span data.
Span data might be discarded for one of the following reasons:
- z/OS has not been configured to collect span data for IBM MQ. Tracked in SMF via QMSTOSFR and QMSTOTSR.
- z/OS has been configured to collect span data for IBM MQ, but has not got capacity to collect span data. Tracked in SMF via QMSTOSFC and QMSTOTSC.
- IBM MQ has reached the limit of how much span data can be stored before it is emitted. Tracked in SMF via QMSTOSFS.
- A transaction has generated more than 1000 spans. Tracked in SMF via QMSTOSPL, QMSTOSCL, QQSTOSPL and QQSTOSCL.
- The queue manager is shutting down with MODE FORCE or RESTART, span data that has not been emitted is discarded.
- The queue manager is shutting down with MODE QUIESCE, after all applications have disconnected the queue manager waits for a maximum of one second for remaining span data to be emitted. Any remaining data is discarded.