OpenTelemetry pika instrumentation
Project description
This library allows tracing requests made by the pika library.
Installation
pip install opentelemetry-instrumentation-pika
Usage
Start broker backend
docker run -p 5672:5672 rabbitmq
Run instrumented task
import pika
from opentelemetry.instrumentation.pika import PikaInstrumentor
PikaInstrumentor().instrument()
connection = pika.BlockingConnection(pika.URLParameters('amqp://localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
channel.basic_publish(exchange='', routing_key='hello', body=b'Hello World!')
PikaInstrumentor also supports instrumentation of a single channel
import pika
from opentelemetry.instrumentation.pika import PikaInstrumentor
connection = pika.BlockingConnection(pika.URLParameters('amqp://localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
pika_instrumentation = PikaInstrumentor()
pika_instrumentation.instrument_channel(channel=channel)
channel.basic_publish(exchange='', routing_key='hello', body=b'Hello World!')
pika_instrumentation.uninstrument_channel(channel=channel)
PikaInstrumentor also supports instrumentation without creating an object, and receiving a tracer_provider
PikaInstrumentor.instrument_channel(channel, tracer_provider=tracer_provider)
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for opentelemetry-instrumentation-pika-0.25b1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2790083de122bc6ea1f9ceb9d145127dd35ad37e6a9c1ad2bd2cef0204043d00 |
|
MD5 | ec71da771fd775007b31983669b88386 |
|
BLAKE2b-256 | 162673ceb31d6c76fa92b4abbea2e1885c15e7fc1c123816676c2af33a52341f |
Close
Hashes for opentelemetry_instrumentation_pika-0.25b1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64398fade2751e52fd947172afc08e4ca19a405a3ccc3c55906ca96aab564318 |
|
MD5 | 2413bf68521f6831aa6f526a266fabf7 |
|
BLAKE2b-256 | f774992a180aa6f0175918745af3ac07d6b48024d5711abad9ed56ab2662262d |