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
Metadata
Release files for opentelemetry-propagator-gcp 1.15.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| opentelemetry_propagator_gcp-1.15.0.tar.gz | 10.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opentelemetry_propagator_gcp-1.15.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.4 kB
Release files / opentelemetry_propagator_gcp-1.15.0.tar.gz
| Download URL | opentelemetry_propagator_gcp-1.15.0.tar.gz |
|---|---|
| Size | 10.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5066851d55be13344985c895ea5f07809226c21de821d864e7ce60602487663
|
|
BLAKE2b-256 checksum How to use checksums |
244256047a7254dce3c689fd2514736370d360071614fd40d0c9af3538013dce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / opentelemetry_propagator_gcp-1.15.0-py3-none-any.whl
| Download URL | opentelemetry_propagator_gcp-1.15.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
130a6d6b6d75a21e3b4239a115836271a12df9a53342e9d27fde4f9853fb67c0
|
|
BLAKE2b-256 checksum How to use checksums |
d88b19c51e18a8bb4f0ff2969cb3c2e56416a54c433cef0cf865d078199a5355
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for opentelemetry-propagator-gcp 1.15.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.