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.1b1.tar.gz.

File metadata

File hashes

Hashes for opentelemetry-instrumentation-pubsub-0.0.1b1.tar.gz
Algorithm Hash digest
SHA256 3877c71ff9a5706bbc1c4e42aafb042fdc9c74f7ad984d3c906e17411966c9e5
MD5 66ed694cae08fe0ea0f6a851d64ced9b
BLAKE2b-256 a41f3c9b732b3d65fbfabf47affae465d16c2fd6e35b25a9287c376ac1132c30

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opentelemetry_instrumentation_pubsub-0.0.1b1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4de979493b253a2cd98010fea55c7d705fdd300e26cb029eb455f501a7d94efc
MD5 c66ae98ce947ba3472d79f0d22e7052c
BLAKE2b-256 be19d335d1f8a40f31b326c1059782e14024cbf2b36a6b4f9c865a10e9b45f22

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