OpenCensus Stackdriver Trace Exporter
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<1.0.0 pipenv install google-cloud-trace<1.0.0
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
Metadata
Release files for opencensus-ext-stackdriver 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| opencensus-ext-stackdriver-0.8.0.tar.gz | 12.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opencensus_ext_stackdriver-0.8.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 24.7 kB
Release files / opencensus-ext-stackdriver-0.8.0.tar.gz
| Download URL | opencensus-ext-stackdriver-0.8.0.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a7870192c01c728618563038a6478c39b7db7da11a77a46d52c457fe26740b9
|
|
BLAKE2b-256 checksum How to use checksums |
ad774358eb4aa3f8efb2b44aa4ecf1d7254ac0820fb1c9c8d806fde8f4133775
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.2
|
Release files / opencensus_ext_stackdriver-0.8.0-py2.py3-none-any.whl
| Download URL | opencensus_ext_stackdriver-0.8.0-py2.py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
6eabc123b6ba44b58d2dacb065572d71ebc9043d9da20fd862f7e61492a88667
|
|
BLAKE2b-256 checksum How to use checksums |
ecf8a62b0c46f195c42a3b26a01d698ff39a77cfdc617fdf1f0542934724af5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.2
|
Security for opencensus-ext-stackdriver 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.