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.25b0.tar.gz.

File metadata

  • Download URL: opentelemetry-instrumentation-pika-0.25b0.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.25b0.tar.gz
Algorithm Hash digest
SHA256 d991c7f452da3d22fe341c06041730109ca19055a8f147361e71a8b6ae720fbe
MD5 0d76f211bae18aae59442a71fcd60915
BLAKE2b-256 1373a8b7b5b4547c1a314c9bfaa93bf27924f868b60d987d5200cb5b7bda380e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opentelemetry_instrumentation_pika-0.25b0-py3-none-any.whl
Algorithm Hash digest
SHA256 26c2f2855ba4109e1fa2b7c095beb160feeb02475cfd42c9d4770311ccb27fe4
MD5 e745d30e377eeb19250bcb8a7a19cc6e
BLAKE2b-256 576c035d61bff42b4eaed474231024d9d073d3662034a06354cf4245143dd460

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