IBM MQ Tracing
IBM MQ Tracing uses an IBM MQ user exit to trace IBM MQ messages. The IBM MQ Tracing user exit supports IBM MQ deployed on-premises and IBM MQ running in containers on a Red Hat OpenShift cluster.
- For IBM MQ that is deployed on premises, tracing data is reported to the Instana host agent on the same host.
- For IBM MQ running in containers on a Red Hat OpenShift cluster, tracing data is reported to the Instana host agent that is deployed on the same node as the queue manager pod.
You can also configure IBM MQ Tracing for reporting tracing data to a remote host agent.
By default, trace correlation information is automatically added to IBM MQ messages that contain MQRFH2 headers or message properties. To append trace correlation information to all the traced messages, set MONITOR_LEVEL
to debug
for the IBM MQ Tracing user exit.
Tracing data collected by IBM MQ Tracing user exit and Tracing data collected by other tracers can be correlated if trace context headers (trace correlation information) are set in IBM MQ messages. Instana trace context headers (X_INSTANA_T
,
X_INSTANA_S
, and X_INSTANA_L
) and the W3C trace context headers (traceparent
and tracestate
) are supported for correlating the data. When IBM MQ Tracing user exit requires propagating trace
correlation information, it propagates Instana tracing headers and W3C trace context headers in IBM MQ messages.
To use IBM MQ Tracing for tracing in IBM MQ messages, enable IBM MQ Tracing in queue managers by following these procedures.
- Enabling IBM MQ Tracing
- Enabling tracing for on-premises IBM MQ
- Enabling tracing for IBM MQ on a Red Hat OpenShift cluster
- Configuring IBM MQ Tracing
- Upgrading IBM MQ Tracing
- Disabling IBM MQ Tracing
- Log files for IBM MQ Tracing
Enabling IBM MQ Tracing
Enabling tracing for on-premises IBM MQ
Supported platforms for on-premises IBM MQ
The IBM MQ Tracing user exit supports on-premises IBM MQ on the following platforms:
- Linux x86_64
- Linux ppc64le
- Linux s390x
- Windows x86_64
- AIX 7.2
- AIX 7.3
Prerequisites for enabling IBM MQ Tracing for on-premises IBM MQ
On Windows x86_64, the Microsoft Visual C++ Redistributable 2019 or later must be installed. The latest Microsoft Visual C++ Redistributable package can be downloaded from the Microsft website.
On AIX 7.2, XL C/C++ Runtime for AIX 16.1.0 Fix Pack 7 or later versions including the file set libc++.rte
must be installed. Use the following command to check
whether the fileset libc++.rte
are installed.
lslpp -l |grep libc++.rte
IBM MQ Server and queue manager instances must be installed and configured before installing and configuring IBM MQ Tracing.
Downloading IBM MQ Tracing user exit for on-premises IBM MQ
Download the IBM MQ Tracing user exit package before enabling tracing for on-premises IBM MQ. To download the IBM MQ Tracing user exit package, complete the following steps.
- Download the IBM MQ Tracing user exit
.tgz
file from the artifactory. To download the file, use_
as the username and a valid agent key as the password. - Extract the downloaded
.tgz
file to a temporary location. After extraction, find five user-exit packages for different platforms in the directory. - Transfer the user exit package specific to a platform on your IBM MQ server.
- Perform one of the following steps:
- On a Linux or AIX IBM MQ server, extract the user exit pacakge into the
/var/mqm/exits64
directory. - On a Windows IBM MQ server, extract the user exit into the
C:\ProgramData\IBM\MQ\exits64
directory.
- On a Linux or AIX IBM MQ server, extract the user exit pacakge into the
- Place the following files into the
exits64
directory:- The IBM MQ user exit binary, which intercepts the IBM MQ API calls and initiates calls to the wrapped OpenTelemetry C++ client library to create spans.
- On Linux and AIX, place the
mqtracingexit_r
file. - On Windows, place the
mqtracingexit.dll
file.
- On Linux and AIX, place the
- The wrapped OpenTelemetry C++ client binary file, which provides functions to manage the lifecycle of spans and sends spans to the Instana host agent.
- On Linux and AIX, place the
tracelibrary.so
file. - On Windows, place the the
tracelibrary.dll
file.
- On Linux and AIX, place the
- The
mqtracingexit.conf
configuration file for IBM MQ Tracing.
- The IBM MQ user exit binary, which intercepts the IBM MQ API calls and initiates calls to the wrapped OpenTelemetry C++ client library to create spans.
Enabling IBM MQ Tracing user exit for on-premises IBM MQ
To enable a user exit for on-premises IBM MQ, edit the mqs.ini
or qm.ini
file . The mqs.ini
file contains information relevant to all the queue manager instances on a host.
- On Linux and AIX, the
mqs.ini
file is in the/var/mqm
directory. - On Windows, the
mqs.ini
file is in theC:\ProgramData\IBM\MQ
directory.
The qm.ini
file contains information relevant to a specific queue manager.
- On Linux and AIX, the
qm.ini
file is in the/var/mqm/qmgrs/<QMNAME>
directory. - On Windows, the
qm.ini
file is in theC:\ProgramData\IBM\MQ\qmgrs\<QMNAME>
directory, where<QMNAME>
is the name of the queue manager.
Enabling IBM MQ Tracing for all the queue manager instances
To enable tracing for all the queue manager instances on a host, complete the following steps:
-
Back up the
mqs.ini
file.- On Linux and AIX, back up the
/var/mqm/mqs.ini
file. - on Windows, back up the
C:\ProgramData\IBM\MQ\mqs.ini
file.
- On Linux and AIX, back up the
-
Edit the
mqs.ini
file. -
Enable user exit for all queue manager instances on this node by adding the following content. When queue manager starts, the attributes in this stanza are read, and then overridden by the user exit that is defined in the
qm.ini
file.- On Linux and AIX, add the following lines:
ApiExitCommon: Sequence=100 Function=EntryPoint Module=/var/mqm/exits64/mqtracingexit Name=TracingApiExit
- On Windows, add the following lines:
ApiExitCommon: Sequence=100 Function=EntryPoint Module=C:\ProgramData\IBM\MQ\exits64\mqtracingexit Name=TracingApiExit
- On Linux and AIX, add the following lines:
Enabling IBM MQ Tracing for a queue manager
To enable tracing for a specific queue manager, complete the following steps:
-
Back up the
qm.ini
file.- On Linux and AIX, back up the
/var/mqm/qmgrs/<QMNAME>/qm.ini
file. - On Windows, back up the
C:\ProgramData\IBM\MQ\qmgrs\<QMNAME>\qm.ini
file.
- On Linux and AIX, back up the
-
Edit the
qm.ini
file. -
Add the following configurations on Linux and AIX:
ApiExitLocal: Sequence=100 Function=EntryPoint Module=/var/mqm/exits64/mqtracingexit Name=TracingApiExit
Add the following configurations on Windows:
ApiExitLocal: Sequence=100 Function=EntryPoint Module=C:\ProgramData\IBM\MQ\exits64\mqtracingexit Name=TracingApiExit
Where:
Sequence
identifies the sequence of this exit in relation to other exits. An exit with a low sequence number is called before an exit with a higher sequence number.Function
identifies the name of the function entry point into the module containing the user exits code.Module
contains the user exits code. If this field contains the full path name of the module, it is used as is. If this field contains only the module name, the module is located using the ExitsDefaultPath attribute in the ExitPath in theqm.ini
file.Name
is the descriptive name of the user exits.
-
Save changes to the
qm.ini
file. -
Restart the queue manager instances to apply the changes.
For more information about enabling a user exit for IBM MQ, see IBM MQ guide.
Enabling tracing for IBM MQ on a Red Hat OpenShift cluster
IBM MQ Operator 2.2.0 and later versions natively support Instana IBM MQ Tracing. To get native support, use IBM MQ queue manager container image 9.3.1.0-r2 or later versions. To enable Instana IBM MQ Tracing for queue managers that are deployed by using IBM MQ Operator 2.2.0 or later versions on an IBM Cloud Pak for Integration cluster or a Red Hat OpenShift Container Platform cluster, see. IBM MQ Tracing is supported on Linux on x86_64, ppc64le, and s390x Kubernetes nodes.
You also can use Instana AutoTrace WebHook to enable Instana IBM MQ tracing for IBM MQ on an IBM Cloud Pak for Integration cluster or a Red Hat OpenShift cluster. All versions of IBM MQ queue manager container images are supported. However,
Instana AutoTrace WebHook supports only linux/amd64
Kubernetes nodes. For more information about how to enable tracing for IBM MQ container that runs on a Red Hat OpenShift cluster (including IBM Cloud Pak for Integration),
see Instana AutoTrace WebHook.
Configuring IBM MQ Tracing
IBM MQ Tracing is configured by default. However, you can modify the IBM MQ Tracing configuration.
Configuring IBM MQ Tracing for on-premises IBM MQ
To configurie IBM MQ Tracing for on-premises IBM MQ, complete the following steps.
-
Go to the
exits64
directory:- For Linux and AIX, go to the
/var/mqm/exits64
directory. - For Windows, go to the
C:\ProgramData\IBM\MQ\exits64
directory.
- For Linux and AIX, go to the
-
Edit the
mqtracingexit.conf
file.# configuration for IBM MQ exit LOG_LEVEL="info" #Log level: info, warn, error, debug SPAN_FORMAT="instana" MONITOR_LEVEL="normal" #MQ tracing level: normal, quiet, off, debug IBMMQ_PUBSUB_SUPPORT = "off" #The switch for the publish/subscribe support: on, off IBMMQ_RFH2_HEADERS_TO_EXPOSE = "" #A list of message headers that must be included in the `PUT` span payload, and each header is separated by commas. INSTANA_AGENT_HOST = "localhost" #(optional) INSTANA_AGENT_PORT = 42699 #(optional) INSTANA_AGENT_PROTO = "http" #(optional) HOST_ALIAS="<YOUR-HOST-NAME>" #(optional)
where:
LOG_LEVEL
specifies the log level. Log level can beinfo
,warn
,error
, ordebug
. The log files are in the/tmp/ibmmqtrace
directory on Linux and AIX and in theC:\ProgramData\IBM\MQ\trace
directory on Windows.- The
SPAN_FORMAT
variable specifies the trace system to which the span data is sent. Set this variable toinstana
. IBM MQ Tracing user exit sends span data to the host agent endpoint http://localhost:42699, by default. To send the span data to a remote host agent by using the HTTPS protocol, update the configuration itemsINSTANA_AGENT_HOST
andINSTANA_AGENT_PROTO
. TheSPAN_FORMAT
setting must be the same for the IBM MQ hosts. MONITOR_LEVEL
specifies the tracing level of IBM MQ, which can be one ofoff
,quiet
,normal
, anddebug
. IfMONITOR_LEVEL
is set tooff
, no tracing data is collected. If it is set toquiet
, the trace correlation information is not added to all the messages, but the messages can still be traced in the IBM MQ server. If it is set tonormal
, the trace correlation information is added to the messages with RFH2 headers or named properties, but is not added to text messages. If it is set todebug
, the trace correlation information is added to all traced messages. If you encounter theMQRC_HEADER_ERROR (MQRC 2142)
error in your message consumer application, you can resolve it by changing theMONITOR_LEVEL
property tonormal
orquiet
, or by changing thePROPCTL
property of the message destination queues toNONE
. Alternatively, to avoid the message header error, you can modify your application to ignore the additional RFH2 header with trace correlation information added by Instana.IBMMQ_PUBSUB_SUPPORT
controls whether the support for tracing publish and subscribe messages are enabled. Set it toon
to enable the support, and set it tooff
to disable the support.IBMMQ_RFH2_HEADERS_TO_EXPOSE
specifies a list of message headers that must be included in the span payload, and each header is separated by commas. For example,IBMMQ_RFH2_HEADERS_TO_EXPOSE="rfh2_folder1.header1, rfh2_folder2.header2, header3"
. Any message header with a size larger than 256 bytes are truncated to avoid creating a span size that is too large and affects the overall performance. Additionally, the total length of all the collected message headers in a span must not exceed 3 KB. Therefore, only the most important headers must be configured for the collection.INSTANA_AGENT_HOST
specifies the agent host where the Instana format span data is sent to, and localhost is used by default. If you specify a remote agent host, you also need to add a linehttp.listen=*
in<instana-agent-dir>/etc/instana/com.instana.agent.main.config.Agent.cfg
for the remote host agent first as the host agent is not reachable from other hosts by default.INSTANA_AGENT_PORT
specifies the port where the Instana agent is listening, and42699
is used by default. You need to change the port only when the agent is listening on another port.INSTANA_AGENT_PROTO
specifies the connection type between IBM MQ Tracing exit and the host agent.HTTP
andHTTPS
protocols are supported andHTTP
is used by default. To change the protocol toHTTPS
, see Setup TLS Encryption for Agent Endpoint to secure the agent endpoint first.HOST_ALIAS
specifies a host alias for the span data that is collected by IBM MQ Tracing user exit. You can link calls to IBM MQ to the infrastructure entity if the IBM MQ sensor also monitors the queue manager. The FQDN of the MQ host is used by default. The host alias value needs to match with the IBM MQ host that is specified in the host agent configuration yaml. If the FQDN of IBM MQ host is not used in the IBM MQ sensor configuration and the host agent is not on the local IBM MQ host, specify a host alias. The IBM MQ sensor can discover the FQDN for the local queue manager instances.
-
Save the file.
-
Rstart queue manager instances.
Note: Instana 246 and later versions support setting a custom service name for IBM MQ Tracing user exit. To set a custom service name, set the INSTANA_SERVICE_NAME
environment variable for the IBM MQ processes.
Configuring IBM MQ Tracing on a Red Hat OpenShift cluster
To change the configuration of IBM MQ Tracing for a queue manager running on a Red Hat OpenShift cluster, add new environment variables to the queue manager pod. The environment variable name must match the configuration item name listed in the Configuring IBM MQ Tracing for on-premises IBM MQ section. To add an environment variable for a queue manager pod, complete the following steps:
-
Log in to your Red Hat OpenShift cluster web console.
-
From the navigation panel, click Operators > Installed Operators. All installed Operators in the specified project are displayed.
-
Select IBM MQ Operator. The IBM MQ Operator window is displayed.
-
Go to the queue manager tab. The queue manager Details window is displayed.
-
Select the queue manager for which you want to change the tracing configuration.
-
Go to the YAML tab.
-
Add the environment variable in spec > template > pod > containers > env section. For example, use the following snippet to change the log level of IBM MQ Tracing to debug:
template: pod: containers: - env: - name: LOG_LEVEL value: debug
-
Save the updated queue manager YAML file.
Upgrading IBM MQ Tracing
When a new version of IBM MQ Tracing is released, you can upgrade IBM MQ Tracing.
Upgrading IBM MQ Tracing for on-premises IBM MQ on Linux or AIX
- Stop the queue manager instances.
- Back up the
/var/mqm/exits64/mqtracingexit.conf
file on the IBM MQ server. - Extract the downloaded IBM MQ Tracing user exit file and replace the corresponding files in the
/var/mqm/exits64
directory. - Start the queue manager instances.
Upgrading IBM MQ Tracing for on-premises IBM MQ on Windows
- Stop the queue manager instances.
- Back up the
C:\ProgramData\IBM\MQ\exits64\mqtracingexit.conf
file on the IBM MQ server. - Extract the downloaded IBM MQ Tracing user exit file, and replace the corresponding files in the
C:\ProgramData\IBM\MQ\exits64
directory. - Start the queue manager instances.
Upgrading IBM MQ Tracing on a Red Hat OpenShift cluster
To upgrade IBM MQ Tracing on a Red Hat OpenShift cluster, perform one of the following steps:
- If IBM MQ Tracing is enabled by using IBM MQ Operator 2.2.0 or later versions, upgrade IBM MQ queue manager.
- If IBM MQ Tracing is enabled by using Instana AutoTrace WebHook, deploy the Instana AutoTrace WebHook again, and restart queue manager pods.
Disabling IBM MQ Tracing
To disable IBM MQ Tracing, change its configuration or disable IBM MQ Tracing user exit.
Disabling IBM MQ Tracing for on-premises IBM MQ
To disable the collection of tracing data in IBM MQ, set MONITOR_LEVEL
to off
in the mqtracingexit.con
file.
To disable IBM MQ Tracing user exit, complete the following steps on IBM MQ hosts:
- Remove the
ApiExitCommon
andApiExitLocal
stanzas that you configured in the/var/mqm/mqs.ini
orC:\ProgramData\IBM\MQ\mqs.ini
file, and remove the/var/mqm/qmgrs/<QMNAME>/qm.ini
orC:\ProgramData\IBM\MQ\qmgrs\<QMNAME>\qm.ini
file from the IBM MQ hosts where IBM MQ Tracing is enabled. - Restart the queue manager instances.
Disabling IBM MQ Tracing on a Red Hat OpenShift cluster
To disable IBM MQ Tracing on a Red Hat OpenShift cluster, perform one of the following steps:
- If IBM MQ Tracing is enabled by using IBM MQ Operator version 2.2.0 or later, set the
Enable Instana tracing
toggle tofalse
in IBM Cloud Pak for Integration Platform UI or the OpenShift web console. See the IBM MQ guide. - If IBM MQ Tracing is enabled by using the Instana AutoTrace WebHook, perform one of the following steps:
- Uninstall the Instana AutoTrace WebHook, and restart the queue mananger pods.
- Uninstall the Instana AutoTrace WebHook, set
autotrace.ibmmq.enabled
tofalse
, and then deploy Instana AutoTrace WebHook again. For the changes to take effect, restart the queue manager pods. See Instana AutoTrace WebHook guide.
Log files for IBM MQ Tracing
IBM MQ Tracing logs are stored in the mqExit*.log
file. To set the log level for IBM MQ Tracing, modify the value for LOG_LEVEL
.
- On Linux and AIX, the log files are in the
/tmp/ibmmqtrace
directory. - On Windows, the log files are in the
C:\ProgramData\IBM\MQ\trace
directory.