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.15.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

opentelemetry_propagator_gcp-1.15.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file opentelemetry_propagator_gcp-1.15.0.tar.gz.

File metadata

File hashes

Hashes for opentelemetry_propagator_gcp-1.15.0.tar.gz
Algorithm Hash digest
SHA256 b5066851d55be13344985c895ea5f07809226c21de821d864e7ce60602487663
MD5 14fcc7e6c87ea97ed604711079d73ba3
BLAKE2b-256 244256047a7254dce3c689fd2514736370d360071614fd40d0c9af3538013dce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opentelemetry_propagator_gcp-1.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 130a6d6b6d75a21e3b4239a115836271a12df9a53342e9d27fde4f9853fb67c0
MD5 4221899233f42ec7f40561a96b44d1df
BLAKE2b-256 d88b19c51e18a8bb4f0ff2969cb3c2e56416a54c433cef0cf865d078199a5355

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.15.0 This release

2 files

1.14.0

2 files

1.12.0

2 files

1.11.0

2 files

1.10.0

2 files

1.9.0

2 files

1.8.0

2 files

1.7.0

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

Supported by

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