Skip to main content
https://badge.fury.io/py/opentelemetry-propagator-gcp.svg Documentation Status

This library provides support for propagating trace context in the Google Cloud X-Cloud-Trace-Context format.

To get started with instrumentation in Google Cloud, see Generate traces and metrics with Python.

To learn more about instrumentation and observability, including opinionated recommendations for Google Cloud Observability, visit Instrumentation and observability.

Installation

pip install opentelemetry-propagator-gcp

Usage

The CloudTraceOneWayPropagator reads the Google Cloud X-Cloud-Trace-Context format, but does not write the X-Cloud-Trace-Context header on outgoing requests. It is intended for use with a CompositePropagator as below.

from opentelemetry.propagate import set_global_textmap
from opentelemetry.propagators.composite import CompositePropagator
from opentelemetry.propagators.cloud_trace_propagator import (
    CloudTraceOneWayPropagator,
)
set_global_textmap(
    CompositePropagator([
        CloudTraceOneWayPropagator(),
        propagate.get_global_textmap(),
    ]),
)

The CloudTraceFormatPropagator reads and writes the X-Cloud-Trace-Context header formats. Note that when using this propagator, the sampled bit is interpreted as the TRACE_TRUE flag, which may cause a higher sampling rate than desired. See the Trace documentation <https://cloud.google.com/trace/docs/setup#force-trace> for additional context.

from opentelemetry.propagate import set_global_textmap
from opentelemetry.propagators.cloud_trace_propagator import (
    CloudTraceFormatPropagator,
)

# Set the X-Cloud-Trace-Context header
set_global_textmap(CloudTraceFormatPropagator())
from opentelemetry.propagate import set_global_textmap
from opentelemetry.propagators.cloud_trace_propagator import (
    CloudTraceFormatPropagator,
)

# Set the X-Cloud-Trace-Context header
set_global_textmap(CloudTraceFormatPropagator())

References

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opentelemetry_propagator_gcp-1.14.0.tar.gz (10.6 kB view details)

Uploaded Source

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_propagator_gcp-1.14.0.tar.gz.

File metadata

File hashes

Hashes for opentelemetry_propagator_gcp-1.14.0.tar.gz
Algorithm Hash digest
SHA256 2d677ec5f0be296a25822a2011b1a5f74ba95c9635b7162f36bd376423b5a943
MD5 d85f39900a6774ab8d571d2510f36ab8
BLAKE2b-256 5fa0606bf37a8a89468c876866fc2952aed6a8d38f2e7f06e096fbc1bf493ae2

See more details on using hashes here.

File details

Details for the file opentelemetry_propagator_gcp-1.14.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_propagator_gcp-1.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a87f9734e2393fef83877efac072da56948a4ad2af66d0966a4d50ad3a5d0d2f
MD5 45eea6c63cbad9a5dfd98b64bfbafaf0
BLAKE2b-256 fa2e226a193335e66059985a827b5b1f0d65845c9a466bd1f9383eee98242c88

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