Skip to main content

OpenCensus Stackdriver Trace Exporter

Project description

pypi

Installation

pip install opencensus-ext-stackdriver

Usage

Trace

This example shows how to report the traces to Stackdriver Trace:

from opencensus.ext.stackdriver import trace_exporter as stackdriver_exporter
from opencensus.trace import tracer as tracer_module

exporter = stackdriver_exporter.StackdriverExporter(
    project_id='your_cloud_project')
tracer = tracer_module.Tracer(exporter=exporter)
pip install google-cloud-trace
pipenv install google-cloud-trace

By default, traces are exported asynchronously, to reduce latency during your code’s execution. If you would like to export data on the main thread use the synchronous transporter:

from opencensus.common.transports.sync import SyncTransport
from opencensus.ext.stackdriver import trace_exporter as stackdriver_exporter
from opencensus.trace import tracer as tracer_module

exporter = stackdriver_exporter.StackdriverExporter(
    project_id='your_cloud_project', transport=SyncTransport)
tracer = tracer_module.Tracer(exporter=exporter)

Stats

The OpenCensus Stackdriver Stats Exporter allows users to export metrics to Stackdriver Monitoring. The API of this project is still evolving. The use of vendoring or a dependency management tool is recommended.

Stackdriver Exporter Usage

Stackdriver Import

from opencensus.ext.stackdriver import stats_exporter as stackdriver
from opencensus.stats import stats as stats_module

Stackdriver Prerequisites

  • OpenCensus Python libraries require Python 2.7 or later.

  • Google Cloud Platform account and project.

  • Google Stackdriver Monitoring enabled on your project (Need help? Click here).

Register the Stackdriver exporter

stats = stats_module.stats
view_manager = stats.view_manager

exporter = stackdriver.new_stats_exporter(stackdriver.Options(project_id="<id_value>"))
view_manager.register_exporter(exporter)
...

Stackdriver Code Reference

In the examples folder, you can find all the necessary steps to get the exporter, register a view, put tags on the measure, and see the values against the Stackdriver monitoring tool once you have defined the project_id.

For further details for the Stackdriver implementation, see the folder stackdriver/stats_exporter/.

Path & File

Short Description

contrib/opencensus-ext-stackdriver/examples/

End to end example

contrib/opencensus-ext-stackdriver/opencensus/ext/stackdriver/stats_exporter/

Stats implementation for Stackdriver

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

opencensus-ext-stackdriver-0.7.4.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

opencensus_ext_stackdriver-0.7.4-py2.py3-none-any.whl (12.2 kB view details)

Uploaded Python 2Python 3

File details

Details for the file opencensus-ext-stackdriver-0.7.4.tar.gz.

File metadata

  • Download URL: opencensus-ext-stackdriver-0.7.4.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for opencensus-ext-stackdriver-0.7.4.tar.gz
Algorithm Hash digest
SHA256 c92a26fa120936aef9771c06e2fd8bc20cd4793c88fd43b8a2c68cd9d6ac37fa
MD5 b1495bdcbe8f2528c9b558cff743543f
BLAKE2b-256 5a7430fc1bb54c47afd556c76665f7e1c995fcc69a6048462085f17d22131cb0

See more details on using hashes here.

File details

Details for the file opencensus_ext_stackdriver-0.7.4-py2.py3-none-any.whl.

File metadata

  • Download URL: opencensus_ext_stackdriver-0.7.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for opencensus_ext_stackdriver-0.7.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 444ecc3bff47c232f333e276909f1ce19da2eecaf2c1d418312129bdfce7cc57
MD5 1068b144ef40c62781ff12533ce8dadf
BLAKE2b-256 2e797fe70ad0e52589ec6aead118625924a42543ad40c41b0849705b457e0a23

See more details on using hashes here.

Supported by

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