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.25b2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71a07dd0dddb0842af0b4fd641a534668fcf27f5421763135616962ffe0d91b2 |
|
MD5 | 2bf8eb59752f6fded82b0b3cb0317444 |
|
BLAKE2b-256 | 57cdb273984d659808de117ea1a711d6f97078d3e829e40e724f1fac769a7e1b |
Close
Hashes for opentelemetry_instrumentation_pika-0.25b2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ef6a9292f99aa0271cd947d220f2e8651f780f9b9bcd353d6694b156b198054 |
|
MD5 | be496b6914133d819e2db6283bd67537 |
|
BLAKE2b-256 | 6e619316d5d95f4f1ea260fcdd5303fdc7bbf395a1a0dca4f31717233f9c6276 |