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

File metadata

File hashes

Hashes for opentelemetry-instrumentation-pubsub-0.0.1b2.tar.gz
Algorithm Hash digest
SHA256 bc63097f0bcabd4b0401fbc6629a4b833bc79aedcff400a816bdfd18c6ff01b8
MD5 ceee52f4633cdf5ba7f75a8040d95ac5
BLAKE2b-256 29a2901ca02a73526df340e33f1342c7a13d07bafa0dec1e5bb722ca4525ca0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opentelemetry_instrumentation_pubsub-0.0.1b2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 967a2748668e460ab77a0384a727573f0e647082fd5fa67269b96e6c333f3831
MD5 fe54e2084f6ed900f62b43b54c023578
BLAKE2b-256 683ab7cdcf37e27555412c6f163a620cdd0c5c14bfae913a1d222e939b4fe87e

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