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.

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

opentelemetry-exporter-gcp-trace-1.3.0.tar.gz (18.1 kB view hashes)

Uploaded Source

Built Distribution

Supported by

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