IBM Support

IBM MQ Tracing Support (IBM-MQ-TRACING-USER-EXITS)

Fix Readme


Abstract

The document describes how to install and enable IBM MQ tracing on your IBM MQ hosts, the tracing data can be sent to Instana or Jaeger depending on the configurations. The current version of IBM MQ Tracing user exits is 2023.2.1. The version information can be found in the configuration file of IBM MQ Tracing user exits.
Update Name/Fix ID: IBM-MQ-TRACING-USER-EXITS

Content

Since the IBM MQ Tracing user exit is already integrated into the Instana product, this page will no longer receive updates. For the most up-to-date information on the IBM MQ Tracing user exit, please consult the Instana documentation available at IBM MQ Tracing.

Download location

IMPORTANT NOTE:
  • To download this update, use _ as the username and a valid Instana agent key as the password.

Fix Download for Multiple Platforms

The following is a list of components, platforms, and file names that apply to this readme file.
Product / Component Name Platforms Fix
IBM MQ Tracing User Exits
AIX pSeries
Linux x86_64
Linux ppc64le
Linux s390x
Windows x86_64
IBM-MQ-TRACING-USER-EXITS

Prerequisites and co-requisites

General description

This fix provides tracing capability for IBM MQ messages. You can download IBM MQ Tracing user exits implementation and configure your IBM MQ server to enable tracing for messages. The tracing data is sent to Instana or Jaeger depending on your configuration.

Platforms and prerequisites 

This component currently supports traditional IBM MQ running on Linux x86_64, Linux ppc64le, Linux s390x, Windows x86_64, AIX 7.2, and AIX 7.3. 

You can use Instana AutoTrace WebHook to this component in IBM Cloud Pak for Integration (amd64 only). You don't need to install the MQ tracing user exits manually in the Cloud Pak for Integration environment. For more information about how to enable tracing for container MQ that runs in Cloud Pak for Integration, see Instana AutoTrace webhook documentation.
From IBM MQ Operator 2.2.0 (CD), IBM Instana MQ tracing is supported natively. Support is available in the IBM MQ queue manager container image 9.3.1.0-r2 (CD). If you are using IBM MQ Operator 2.2.0 or later in an IBM Cloud Pak for Integration cluster or a Red Hat OpenShift Container Platform cluster, you can enable Instana IBM MQ tracing by following the IBM MQ guide here. Linux on x86_64, ppc64le and s390x are supported for this kind of usage.
On Windows x86_64, the Microsoft Visual C++ Redistributable 2019 or above must be installed. The latest Microsoft Visual C++ Redistributable package can be downloaded from here.
On AIX 7.2, XL C/C++ Runtime for AIX 16.1.0 Fix Pack 7 or above, including the fileset libc++.rte, must be installed.  Use command "lslpp -l |grep libc++.rte" to check whether the fileset libc++.rte is installed.
Instana and Jaeger are the supported tracing systems. If you choose to send tracing data to Instana, you must have Instana host agent installed. Follow https://www.ibm.com/docs/en/obi/current?topic=agent-installation-requirements#installing-on-an-operating-system to install and run Instana Host Agent. The IBM MQ Tracing user exits report tracing data to the Instana host agent on the same host by default. You also can configure it to report data to a remote Instana host agent. See Configuring IBM MQ tracing for details.
The trace correlation information is automatically added to IBM MQ messages with MQRFH2 headers or message properties by default. If you want to append trace correlation information to all the traced messages, you need to change the value of MONITOR_LEVEL to debug in the configuration file of IBM MQ Tracing user exits.
IBM MQ Server and queue managers must be installed and configured before installing and configuring this component.

Known issues

None

Installing

1. Download the package from the Instana public artifactory to your IBM MQ server host, the package includes the following three files:
  • mqtracingexit_r (Linux and AIX) / mqtracingexit.dll (Windows): The IBM MQ user exits, which intercept the IBM MQ API calls and invokes the wrapped OpenTelemetry C++ client library to create spans.
  • tracelibrary.so (Linux and AIX) / tracelibrary.dll (Windows): The wrapped OpenTelemetry C++ client, which provides functions to manage the lifecycle of spans, and sends spans to the target-tracing system.
  • mqtracingexit.conf: The configuration file to specify the target-tracing system (Jaeger or Instana) and the parameters for span generation.
2. Extract the tar file into /var/mqm/exits64 directory on your Linux and AIX IBM MQ server, or extract the zip file into C:\ProgramData\IBM\MQ\exits64 on your Windows IBM MQ server. 

Configuring

This section describes how to configure your IBM MQ to enable tracing, including two parts - Configuring user exits and Configuring IBM MQ tracing.

Configuring user exits

You need to edit mqs.ini or qm.ini file to configure user exits. The mqs.ini file contains information relevant to all the queue managers on a particular node. The qm.ini file contains information relevant to a specific queue manager. The mqs.ini file is located at /var/mqm on Linux and AIX, on Windows it is located in C:\ProgramData\IBM\MQ. The qm.ini file is located at /var/mqm/qmgrs/<QMNAME> on Linux and AIX, on Windows it is located in C:\ProgramData\IBM\MQ\qmgrs\<QMNAME>.

Complete the following steps to enable tracing for all the queue managers on a particular node:

1. Backup /var/mqm/mqs.ini file on Linux and AIX, or backup C:\ProgramData\IBM\MQ\mqs.ini on Windows.
2. Edit the mqs.ini file.

Add the following content to enable user exits for all queue managers on this node. When any queue manager starts, the attributes in this stanza are read, and then overridden by the user exits defined in qm.ini.
Linux and AIX:

ApiExitCommon:
   Sequence=100
   Function=EntryPoint
   Module=/var/mqm/exits64/mqtracingexit
   Name=TracingApiExit

Windows:

ApiExitCommon:
   Sequence=100
   Function=EntryPoint
   Module=C:\ProgramData\IBM\MQ\exits64\mqtracingexit
   Name=TracingApiExit

Complete the following steps to enable tracing for a particular queue manager or to change user exits settings for a particular queue manager.

1. Backup /var/mqm/qmgrs/<QMNAME>/qm.ini file on Linux and AIX, or backup C:\ProgramData\IBM\MQ\qmgrs\<QMNAME>\qm.ini file on Windows.
2. Edit qm.ini.

Add the following content on Linux and AIX:

ApiExitLocal:
   Sequence=100
   Function=EntryPoint
   Module=/var/mqm/exits64/mqtracingexit
   Name=TracingApiExit

Add the following content on Windows:

ApiExitCommon:
   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 by using the ExitsDefaultPath attribute in the ExitPath in qm.ini.
  • Name is the descriptive name of the user exits.

For more information, see Configuring API exits in IBM MQ document library.

You need to save changes to the configuration files, and restart queue managers for the changes to take effect.

Configuring IBM MQ tracing

1. Go to /var/mqm/exits64 directory on Linux and AIX, or go to C:\ProgramData\IBM\MQ\exits64 on Windows.

2. Edit mqtracingexit.conf file.

LOG_LEVEL="info" #Log level: info, warn, error, debug
SPAN_FORMAT="instana" #specify opentracing span format as instana or jaeger
MONITOR_LEVEL="normal" #MQ tracing level: normal, quiet, off, debug
JAEGER_ENDPOINT = "http://127.0.0.1:14268/api/traces"
JAEGER_SAMPLER_TYPE = "const"
JAEGER_SAMPLER_PARAM = 1.0
IBMMQ_PUBSUB_SUPPORT = "off" #The switch for the publish/subscribe support: on, off.
#IBMMQ_RFH2_HEADERS_TO_EXPOSE = "" #A list of message headers that should be included in the span payload, with each header separated by commas.
#JAEGER_AGENT_HOST = "127.0.0.1"
#JAEGER_AGENT_PORT = 6831 
#INSTANA_AGENT_HOST = "localhost" # instana agent host, localhost will be used by default
#INSTANA_AGENT_PORT = 42699 # instana agent port, 42699 will be used by default
#INSTANA_AGENT_PROTO = "http" # connection type between mq tracing exit and instana agent, http and https are supported, http will be used by default
#HOST_ALIAS="<YOUR-HOST-NAME>" # host name to match with instana agent configuration.yaml


Where:

  • LOG_LEVEL specifies the log level, which can be one of info, warn, error and debug. The log files are located at /tmp/ibmmqtrace directory on Linux and AIX. The log files are located at C:\ProgramData\IBM\MQ\trace directory on Windows.
  • SPAN_FORMAT specifies where the span data is sent to. The SPAN format can be set to instana or jaeger. If SPAN_FORMAT is set to instana, IBM MQ Tracing user exits sends span data to the Instana host agent endpoint http://localhost:42699 by default. In such a case, you can ignore JAEGER_* parameters in mqtracingexit.conf file. Update the configuration items INSTANA_AGENT_HOST and INSTANA_AGENT_PROTO, if you want to send the span data to a remote host agent by using https protocol. If SPAN_FORMAT is set to Jaeger, you need to configure JAEGER_* parameters. In such a case, you can ignore INSTANA_* parameters. You must use the same SPAN_FORMAT setting for all IBM MQ nodes.
  • MONITOR_LEVEL specifies the tracing level of IBM MQ, which can be one of off, quiet, normal and debug. If MONITOR_LEVEL is set to off, no tracing data will be collected. If it is set to quiet, the trace correlation information will not be added to all the messages, but the messages can still be traced in the MQ server. If it is set to normal, the trace correlation information will be added to the messages with RFH2 headers or named properties, but will not be added to text messages. If it is set to debug, the trace correlation information will be added to all traced messages. If you encounter the MQRC_HEADER_ERROR (MQRC 2142) error in your message consumer application, you can resolve it by changing the MONITOR_LEVEL property to normal or quiet, or by changing the PROPCTL property of the message destination queues to NONE. Alternatively, you can modify your application to ignore the additional RFH2 header with trace correlation information added by Instana, to avoid the message header error.
  • JAEGER_ENDPOINT specifies Jaeger collector endpoint. You can choose to send tracing data to Jaeger collector or to the Jaeger agent. If you want to send tracing data to Jaeger agent, comment this line and specify values for configuration item JAEGER_AGENT_HOST and JAEGER_AGENT_PORT.
  • JAEGER_SAMPLER_TYPE specifies the sample type. The value can be one of const, probabilistic, ratelimiting, or remote.
  • JAEGER_SAMPLER_PARAM is interpreted based on the value of JAEGER_SAMPLER_TYPE. See more details at https://www.jaegertracing.io/docs/1.22/sampling/#client-sampling-configuration.
  • JAEGER_AGENT_HOST specifies Jaeger agent host.
  • JAEGER_AGENT_PORT specifies Jaeger agent port.
  • IBMMQ_PUBSUB_SUPPORT controls whether the support for tracing publish and subscribe messages is enabled. Set it to 'on' to enable the support, and set it to 'off' to disable the support.
  • IBMMQ_RFH2_HEADERS_TO_EXPOSE specifies a list of message headers that should be included in the span payload, with each header separated by commas. For example, IBMMQ_RFH2_HEADERS_TO_EXPOSE="rfh2_folder1.header1, rfh2_folder2.header2, header3". To avoid creating a span size that is too large and negatively affecting overall performance, any message header with a size larger than 256 bytes will be truncated.  Additionally, the total length of all collected message headers in a span cannot exceed 3K bytes. It is recommended that only the most important headers be configured for 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 line http.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  on, and 42699 is used by default. You only need to change the port when the agent is listening on another port.
  • INSTANA_AGENT_PROTO specifies the connection type between IBM MQ tracing exits and the host agent. http and https are supported, and http is used by default. If you want to change it to https, you need to follow https://www.ibm.com/docs/en/obi/current?topic=agent-host-configuration#setting-up-tls-encryption-for-agent-endpoint to secure the agent endpoint first.
  • HOST_ALIAS specifies a host alias for the span data collected by IBM MQ Tracing user exits, so we can link calls to IBM MQ to the infrastructure entity if the Queue Manager is also monitored by the IBM MQ sensor. The FQDN of IBM MQ host is used by default. The host alias value must match with the IBM MQ host specified in host agent configuration yaml. You only need to specify a host alias if the FQDN of IBM MQ host is not used in IBM MQ sensor configuration when the host agent is not on the local IBM MQ host. The IBM MQ sensor can discover the FQDN for the local Queue Managers.
3. Save the file and restart queue managers.
Repeat installation and configuration steps on other IBM MQ nodes that you want to enable tracing.
You can view IBM MQ tracing data on Instana UI or Jaeger UI depending on the SPAN_FORMAT settings in mqtracingexit.conf file.
Note:  Starting from the 2023.1.1 release, the environment variable INSTANA_SERVICE_NAME will be supported. If this environment variable is set, then the annotation data.service will be added to all IBM MQ spans.

Trace correlation

Tracing data that is collected by IBM MQ Tracing user exit can be correlated with tracing data collected by other tracers when trace context headers are set in the MQ messages. Both the 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 this purpose. When IBM MQ tracing user exit needs to propagate trace correlation information, it propagates both the Instana tracing headers and the W3C trace context headers in MQ messages.

Upgrade

1. Backup /var/mqm/exits64/mqtracingexit.conf on your Linux and AIX IBM MQ server,  or backup C:\ProgramData\IBM\MQ\exits64\mqtracingexit.conf file on your Windows IBM MQ server.
2. Extract the downloaded IBM MQ Tracing user exits file and replace the corresponding files in /var/mqm/exits64 directory on Linux and AIX, or in C:\ProgramData\IBM\MQ\exits64 directory on Windows.
3. Restart the queue managers.

Unconfiguring

1. Remove the ApiExitCommon and ApiExitLocal stanzas that you configured in /var/mqm/mqs.ini(C:\ProgramData\IBM\MQ\mqs.ini) file and /var/mqm/qmgrs/<QMNAME>/qm.ini(C:\ProgramData\IBM\MQ\qmgrs\<QMNAME>\qm.ini) file from the IBM MQ hosts that you enabled tracing.
2. Restart the queue managers.
3. Repeat steps on other IBM MQ nodes.

Troubleshooting

The log files are located at /tmp/ibmmqtrace directory on Linux and AIX, and the log files are located at C:\ProgramData\IBM\MQ\trace directory on Windows. The file name is mqExit*.log
You can set log level in mqtracingexit.conf as described in Configuring IBM MQ tracing section.

Additional information

The Secure Hash Algorithm 1 (SHA256) checksums of the images are as follows:

ibm-mq-tracing-exits_aix_64bit.tar.gz:
5ebb73f7393fc08bfc166297574c9aea2a61dbb916b183702fee717e931b6370

ibm-mq-tracing-exits_xLinux_64bit.tar.gz:
a08f06195954f3afeb694ffe9a1d50c8974ab27dfe8dfa4cc73da3f9f48c72f2
ibm-mq-tracing-exits_pLinuxle_64bit.tar.gz:
73508108d633073ff6755c620a2f9388cfd765c3bc03b2ad13686f42c76008a3
ibm-mq-tracing-exits_zLinux_64bit.tar.gz:
f28ce46d624747fe0b61bffb72cf9bebfcaa2f495b972c27fa9dec05758192e5
ibm-mq-tracing-exits_win_64bit.zip
7106547d70ab5db04ec0f68aa1fc3ed113016b91b5b6a39c9b745632830e393c

Document change history

Version Date Description of change
18.0 2 June 2023 Updated IBM MQ Tracing user exits version to 2023.2.1.
Fixed an unexpected MQ API exit error on AIX.
17.0 8 May 2023 Updated IBM MQ Tracing user exits version to 2023.2.0.
Changed the length of the MQ message header X_INSTANA_T that contains the Instana trace ID to 16 characters in length.
16.0 27 Mar 2023 Updated IBM MQ Tracing user exits version to 2023.1.1.
Added support for displaying message headers on Instana UI.
Added support for environment variable INSTANA_SERVICE_NAME.
Changed the default value of configuration item IBMMQ_PUBSUB_SUPPORT to off.
15.0 27 Feb 2023 Updated IBM MQ Tracing user exits version to 2023.1.0.
Added support for tracing publish/subscribe messages.
Added a new monitor level 'quiet' to prevent trace context propagation.
Fixed the service name extraction issue in Instana when the MQ server name contains the character "-".
14.0 2 Dec 2022 Updated IBM MQ Tracing user exits version to 2022.4.3.
Added support for Windows 64.
Fixed the correlation issue with the ACE OpenTelemetry trace.
13.0 22 Nov 2022 Updated IBM MQ Tracing user exits version to 2022.4.2.
Fixed the log file permission issue in the environment where both MQ and ACE are installed.
Moved the log files of IBM MQ tracing user exit to the directory /tmp/ibmmqtrace.
Removed the unexpected message headers from the messages to ACE system queues.
Fixed the issue of the unexpected API exit error (reason code 2374) in MQ error logs.
12.0 10 Nov 2022 Updated IBM MQ Tracing user exits version to 2022.4.1, upgraded the OpenSSL version to 1.1.1s in trace library.
11.0 1 Nov 2022 Updated IBM MQ Tracing user exits version to 2022.4.0, added support for W3C trace context when the span format is instana.
10.0 30 Sep 2022 Updated IBM MQ Tracing user exits version to 2022.3.4, added support for non-default Instana agent port.
9.0 22 Sep 2022 Updated IBM MQ Tracing user exits version to 2022.3.1, added support for AIX 7.3.
8.0 27 July 2022 Updated IBM MQ Tracing user exits version to 2022.3.0, added support for Linux ppc64le.
7.0 22 June 2022 Updated IBM MQ Tracing user exits version to 2022.2.2, added support for monitoring level debug.
6.0 3 June 2022 Updated IBM MQ Tracing user exits version to 2022.2.1, added support for container IBM MQ in CP4I.
5.0 12 May 2022 Updated IBM MQ Tracing user exits version to 2022.2.0, added support for Linux s390x.
4.0 8 Apr 2022 Updated IBM MQ Tracing user exits version to 2022.1.1, added support for AIX 7.2.
3.0 17 Mar 2022 Updated IBM MQ Tracing user exits version to 2022.1.0.
2.0 18 Nov 2021 Updated IBM MQ Tracing user exits version to 2021.4.0.
1.0 27 Aug 2021 Initial Version.

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSVJUL","label":"IBM Application Performance Management"},"Component":"","Platform":[{"code":"PF016","label":"Linux"}],"Version":"8.1.4","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
05 June 2023

UID

ibm16484595