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
Hashes for opentelemetry-propagator-gcp-1.4.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8926a0dfc11e8afa89780a99ca7302c3a9179716e0679a18f445fde4b6fea5b |
|
MD5 | d62fab9c47023f1f3691e445e66b965f |
|
BLAKE2b-256 | 4e6e73f827afc0048b35de34e72af2aeaf35633547a6ec393119ecb49b57f9b2 |
Hashes for opentelemetry_propagator_gcp-1.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db253f6ba947221f05bc5dfa550f38210d7879d1197537bd891df8708904ca65 |
|
MD5 | 5e8ea1abae479e8c1e4118dca1853f97 |
|
BLAKE2b-256 | b5b915124048cf12940aa0fbd72ee36282d29d0afc544064e042b5f8e9768c09 |