Google Cloud propagator for OpenTelemetry
Project description
This library provides support for propagating trace context in the Google Cloud X-Cloud-Trace-Context format.
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
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file opentelemetry-propagator-gcp-1.6.0.tar.gz
.
File metadata
- Download URL: opentelemetry-propagator-gcp-1.6.0.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6395556dd57612b69bdd93448325afbb0f2ea02d912f9fccf836c99b5776914a |
|
MD5 | 217be3fe9c7f1d048007c64e3ebc2714 |
|
BLAKE2b-256 | 19ba8222dd2e17aa15e049f91b8bd70e44f9c2751cb983063cc79348bb68a30d |
File details
Details for the file opentelemetry_propagator_gcp-1.6.0-py3-none-any.whl
.
File metadata
- Download URL: opentelemetry_propagator_gcp-1.6.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c5f56050ab590aebde1c8caa266dfb5932dc3ea3c6e394b47d5325a9b7452f3 |
|
MD5 | c2f4b031444f534dc97380896f49251c |
|
BLAKE2b-256 | d3544236b67c4549b5bb4d7f3ef845c557f4a980271671816f3b67b521a84c2b |