Skip to main content

OpenTelemetry pika instrumentation

Project description

pypi

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


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

File details

Details for the file opentelemetry-instrumentation-pika-0.25b1.tar.gz.

File metadata

  • Download URL: opentelemetry-instrumentation-pika-0.25b1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12

File hashes

Hashes for opentelemetry-instrumentation-pika-0.25b1.tar.gz
Algorithm Hash digest
SHA256 2790083de122bc6ea1f9ceb9d145127dd35ad37e6a9c1ad2bd2cef0204043d00
MD5 ec71da771fd775007b31983669b88386
BLAKE2b-256 162673ceb31d6c76fa92b4abbea2e1885c15e7fc1c123816676c2af33a52341f

See more details on using hashes here.

File details

Details for the file opentelemetry_instrumentation_pika-0.25b1-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_instrumentation_pika-0.25b1-py3-none-any.whl
Algorithm Hash digest
SHA256 64398fade2751e52fd947172afc08e4ca19a405a3ccc3c55906ca96aab564318
MD5 2413bf68521f6831aa6f526a266fabf7
BLAKE2b-256 f774992a180aa6f0175918745af3ac07d6b48024d5711abad9ed56ab2662262d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page