Skip to main content

Instrument Open Telemetry tracing within the GCP PubSub library

Project description

Open Telemetry GCP PubSub Instrumentation for Python

CircleCI PyPi version

This package provides automatic instrumentation for the google-cloud-pubsub client library.

Installation

pip install opentelemetry-instrumentation-pubsub

Usage

Initiate the instrumentor after configuring your Open Telemetry trace provider.

from google.cloud import pubsub_v1
from pubsub_opentelemetry import PubSubInstrumentationProvider


# Instrument PubSub
PubSubInstrumentationProvider().instrument()

# Publish creates a span with PubSub specific attributes
with pubsub_v1.PublisherClient() as publisher:
    publisher.publish(topic_name, b'My first message!')

# Subscribe propagates the context from the received message
with pubsub_v1.SubscriberClient() as subscriber:
    subscriber.subscribe(subscription_name, callback)

Development

Install dependencies:

make install

Run lint checks:

make lint

Run unit tests:

make test

Run tests against supported Python versions (using tox):

make tox

License

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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file opentelemetry-instrumentation-pubsub-0.0.1b3.tar.gz.

File metadata

File hashes

Hashes for opentelemetry-instrumentation-pubsub-0.0.1b3.tar.gz
Algorithm Hash digest
SHA256 6b0c1f8940a4794e2c1c97b27a15bd68f3e7ff62dcb026d084b8803edfd17d01
MD5 dd133c7d606b3183992b77809c681c89
BLAKE2b-256 073081943a38d831ce73c04ae9afc7a1764b103eaf6a7cb81810e4126d2ae1cd

See more details on using hashes here.

File details

Details for the file opentelemetry_instrumentation_pubsub-0.0.1b3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_instrumentation_pubsub-0.0.1b3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0125706a7d6856fd52e2e5168b774533743c51aec04ae9e666eb4eb68f2d3d94
MD5 0f63bb0aa9ab689f67ecd65c8f1b0328
BLAKE2b-256 12e843a79b2fc72debcec620975899ff7f4a8d0bf5d52dd00aa59343f5e1e31e

See more details on using hashes here.

Supported by

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