Skip to main content

Google Cloud Trace exporter for OpenTelemetry

Project description

https://badge.fury.io/py/opentelemetry-exporter-gcp-trace.svg Documentation Status

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

Project details


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_exporter_gcp_trace-1.9.0.tar.gz.

File metadata

File hashes

Hashes for opentelemetry_exporter_gcp_trace-1.9.0.tar.gz
Algorithm Hash digest
SHA256 c3fc090342f6ee32a0cc41a5716a6bb716b4422d19facefcb22dc4c6b683ece8
MD5 3febd503e51128feb23168cae3dd210a
BLAKE2b-256 c3157556d54b01fb894497f69a98d57faa9caa45ffa59896e0bba6847a7f0d15

See more details on using hashes here.

File details

Details for the file opentelemetry_exporter_gcp_trace-1.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opentelemetry_exporter_gcp_trace-1.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a8396e8b39f636eeddc3f0ae08ddb40c40f288bc8c5544727c3581545e77254
MD5 59a6cbcd602a8a8d67d693ae1c552f87
BLAKE2b-256 c0cd6d7fbad05771eb3c2bace20f6360ce5dac5ca751c6f2122853e43830c32e

See more details on using hashes here.

Supported by

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