Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit 862885a

Browse files
authored
Changing default transport for stackdriver exporter (#929)
1 parent b332ae3 commit 862885a

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

contrib/opencensus-ext-stackdriver/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Changelog
22

33
## Unreleased
4+
- Change default transporter in stackdriver exporter
5+
([#929](https://github.com/census-instrumentation/opencensus-python/pull/929))
46

57
## 0.7.3
68
Released 2020-06-29

contrib/opencensus-ext-stackdriver/README.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,19 @@ This example shows how to report the traces to Stackdriver Trace:
3535
pip install google-cloud-trace
3636
pipenv install google-cloud-trace
3737

38-
By default, traces are exported synchronously, which introduces latency during
39-
your code's execution. To avoid blocking code execution, you can initialize
40-
your exporter to use a background thread.
38+
By default, traces are exported asynchronously, to reduce latency during
39+
your code's execution. If you would like to export data on the main thread
40+
use the synchronous transporter:
4141

42-
This example shows how to configure OpenCensus to use a background thread:
4342

4443
.. code:: python
4544
46-
from opencensus.common.transports.async_ import AsyncTransport
45+
from opencensus.common.transports.sync import SyncTransport
4746
from opencensus.ext.stackdriver import trace_exporter as stackdriver_exporter
4847
from opencensus.trace import tracer as tracer_module
4948
5049
exporter = stackdriver_exporter.StackdriverExporter(
51-
project_id='your_cloud_project', transport=AsyncTransport)
50+
project_id='your_cloud_project', transport=SyncTransport)
5251
tracer = tracer_module.Tracer(exporter=exporter)
5352
5453
Stats

contrib/opencensus-ext-stackdriver/opencensus/ext/stackdriver/trace_exporter/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
k8s_utils,
2424
monitored_resource,
2525
)
26-
from opencensus.common.transports import sync
26+
from opencensus.common.transports.async_ import AsyncTransport
2727
from opencensus.common.version import __version__
2828
from opencensus.trace import attributes_helper, base_exporter, span_data
2929
from opencensus.trace.attributes import Attributes
@@ -180,7 +180,7 @@ class StackdriverExporter(base_exporter.Exporter):
180180
"""
181181

182182
def __init__(self, client=None, project_id=None,
183-
transport=sync.SyncTransport):
183+
transport=AsyncTransport):
184184
# The client will handle the case when project_id is None
185185
if client is None:
186186
client = Client(project=project_id)

0 commit comments

Comments
 (0)