Chapter 10. Logging and tracing
10.1. Enabling protocol logging
The client can log AMQP protocol frames to the console. This data is often critical when diagnosing problems.
To enable protocol logging, set the PN_TRACE_FRM
environment variable to 1
:
Example: Enabling protocol logging
$ export PN_TRACE_FRM=1
$ <your-client-program>
To disable protocol logging, unset the PN_TRACE_FRM
environment variable.
10.2. Enabling distributed tracing
The client offers distributed tracing based on the Jaeger implementation of the OpenTracing standard. Use the following steps to enable tracing in your application:
Install the tracing dependencies.
Red Hat Enterprise Linux 7
$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ sudo yum install python2-pip $ pip install --user --upgrade setuptools $ pip install --user opentracing jaeger-client
Red Hat Enterprise Linux 8
$ sudo dnf install python3-pip $ pip3 install --user opentracing jaeger-client
Register the global tracer in your program.
Example: Global tracer configuration
from proton.tracing import init_tracer tracer = init_tracer("<service-name>")
For more information about Jaeger configuration, see Jaeger Sampling.
When testing or debugging, you may want to force Jaeger to trace a particular operation. See the Jaeger Python client documentation for more information.
To view the traces your application captures, use the Jaeger Getting Started to run the Jaeger infrastructure and console.