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)

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

File metadata

File hashes

Hashes for opentelemetry-instrumentation-pubsub-0.0.1a8.tar.gz
Algorithm Hash digest
SHA256 f27fae93df64665d077e4ebb2b252f2f9c77cba4ffa0e44485f6ba509002fa57
MD5 89c3db020e5e18601c2010c58afe07b0
BLAKE2b-256 3619a7f01b05e01fe3e0a730934a5fe76a8a1cfbe77e6ea2603bea468e771aea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opentelemetry_instrumentation_pubsub-0.0.1a8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0266e1130c4c76828e2ba79c64f2f12d46087a6f1d4a5d8a63e2f403e4202886
MD5 d8dddb2680bde9d33b613bdb11c345df
BLAKE2b-256 ed89e25df42c2da264658ea89ab3a7bcd0d2aecaa1b60123883554471fa4c0be

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