Google Cloud Trace exporter for OpenTelemetry
Project Links
Meta
Author: Google
Requires Python: >=3.9
Classifiers
Development Status
- 4 - Beta
Intended Audience
- Developers
License
- OSI Approved :: Apache Software License
Programming Language
- Python
- Python :: 3
- Python :: 3.9
- Python :: 3.10
- Python :: 3.11
- Python :: 3.12
- Python :: 3.13
This library provides support for exporting traces to Google Cloud Trace.
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.
For resource detection and GCP trace context propagation, see opentelemetry-tools-google-cloud. For the Google Cloud Monitoring exporter, see opentelemetry-exporter-gcp-monitoring.
Installation
pip install opentelemetry-exporter-gcp-trace
Usage
from opentelemetry import trace
from opentelemetry.exporter.cloud_trace import CloudTraceSpanExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import (
SimpleSpanProcessor,
)
trace.set_tracer_provider(TracerProvider())
cloud_trace_exporter = CloudTraceSpanExporter(
project_id='my-gcloud-project',
)
trace.get_tracer_provider().add_span_processor(
SimpleSpanProcessor(cloud_trace_exporter)
)
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span('foo'):
print('Hello world!')
References
1.10.0
Oct 14, 2025
1.9.0
Feb 04, 2025
1.8.0
Jan 08, 2025
1.7.0
Aug 27, 2024
1.6.0
Oct 16, 2023
1.5.0
May 17, 2023
1.4.0
Dec 05, 2022
1.3.0
Apr 21, 2022
1.2.0
Apr 05, 2022
1.1.0
Jan 13, 2022
1.0.0
May 13, 2021
1.0.0rc0
Apr 22, 2021