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

Commit 2857864

Browse files
kornholic24t
authored andcommitted
Remove deprecated transports (#452)
Replace trace transports with common transports, increasing default batch size and changing behavior on exit.
1 parent 989470e commit 2857864

File tree

22 files changed

+36
-677
lines changed

22 files changed

+36
-677
lines changed

README.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,12 @@ This example shows how to configure Census to use a background thread:
158158

159159
.. code:: python
160160
161+
from opencensus.common.transport.async_ import AsyncTransport
161162
from opencensus.trace.exporters import stackdriver_exporter
162163
from opencensus.trace import tracer as tracer_module
163-
from opencensus.trace.exporters.transports.background_thread \
164-
import BackgroundThreadTransport
165164
166165
exporter = stackdriver_exporter.StackdriverExporter(
167-
project_id='your_cloud_project', transport=BackgroundThreadTransport)
166+
project_id='your_cloud_project', transport=AsyncTransport)
168167
tracer = tracer_module.Tracer(exporter=exporter)
169168
170169
Propagators

opencensus/common/transports/async_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from opencensus.common.transports import base
2323

2424
_DEFAULT_GRACE_PERIOD = 5.0 # Seconds
25-
_DEFAULT_MAX_BATCH_SIZE = 200
25+
_DEFAULT_MAX_BATCH_SIZE = 600
2626
_WAIT_PERIOD = 60.0 # Seconds
2727
_WORKER_THREAD_NAME = 'opencensus.common.Worker'
2828
_WORKER_TERMINATOR = object()

opencensus/trace/exporters/file_exporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
import json
1818

19+
from opencensus.common.transports import sync
1920
from opencensus.trace import span_data
2021
from opencensus.trace.exporters import base
21-
from opencensus.trace.exporters.transports import sync
2222

2323
DEFAULT_FILENAME = 'opencensus-traces.json'
2424

@@ -33,7 +33,7 @@ class FileExporter(base.Exporter):
3333
extend from the base :class:`.Transport` type and
3434
implement :meth:`.Transport.export`. Defaults to
3535
:class:`.SyncTransport`. The other option is
36-
:class:`.BackgroundThreadTransport`.
36+
:class:`.AsyncTransport`.
3737
3838
:type file_mode: str
3939
:param file_mode: The file mode to open the output file with.

opencensus/trace/exporters/jaeger_exporter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
from thrift.protocol import TBinaryProtocol, TCompactProtocol
2121
from thrift.transport import THttpClient, TTransport
2222

23+
from opencensus.common.transports import sync
2324
from opencensus.common.utils import timestamp_to_microseconds
2425
from opencensus.trace import link as link_module
2526
from opencensus.trace.exporters import base
2627
from opencensus.trace.exporters.gen.jaeger import agent, jaeger
27-
from opencensus.trace.exporters.transports import sync
2828

2929
DEFAULT_HOST_NAME = 'localhost'
3030
DEFAULT_AGENT_PORT = 6831
@@ -71,7 +71,7 @@ class JaegerExporter(base.Exporter):
7171
extend from the base :class:`.Transport` type and
7272
implement :meth:`.Transport.export`. Defaults to
7373
:class:`.SyncTransport`. The other option is
74-
:class:`.BackgroundThreadTransport`.
74+
:class:`.AsyncTransport`.
7575
"""
7676

7777
def __init__(
@@ -332,7 +332,7 @@ class Collector(base.Exporter):
332332
extend from the base :class:`.Transport` type and
333333
implement :meth:`.Transport.export`. Defaults to
334334
:class:`.SyncTransport`. The other option is
335-
:class:`.BackgroundThreadTransport`.
335+
:class:`.AsyncTransport`.
336336
337337
:type http_transport: :class:`type`
338338
:param http_transport: Class for creating new client for Thrift
@@ -414,7 +414,7 @@ class AgentClientUDP(base.Exporter):
414414
extend from the base :class:`.Transport` type and
415415
implement :meth:`.Transport.export`. Defaults to
416416
:class:`.SyncTransport`. The other option is
417-
:class:`.BackgroundThreadTransport`.
417+
:class:`.AsyncTransport`.
418418
"""
419419

420420
def __init__(

opencensus/trace/exporters/logging_exporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
import logging
1818

19+
from opencensus.common.transports import sync
1920
from opencensus.trace import span_data
2021
from opencensus.trace.exporters import base
21-
from opencensus.trace.exporters.transports import sync
2222

2323

2424
class LoggingExporter(base.Exporter):
@@ -33,7 +33,7 @@ class LoggingExporter(base.Exporter):
3333
extend from the base :class:`.Transport` type and
3434
implement :meth:`.Transport.export`. Defaults to
3535
:class:`.SyncTransport`. The other option is
36-
:class:`.BackgroundThreadTransport`.
36+
:class:`.AsyncTransport`.
3737
3838
Example:
3939

opencensus/trace/exporters/ocagent/trace_exporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import socket
2121

2222
from opencensus.__version__ import __version__
23+
from opencensus.common.transports import sync
2324
from opencensus.trace.exporters import base
2425
from opencensus.trace.exporters.gen.opencensus.agent.common.v1 \
2526
import common_pb2
@@ -28,7 +29,6 @@
2829
from opencensus.trace.exporters.gen.opencensus.agent.trace.v1 \
2930
import trace_service_pb2_grpc
3031
from opencensus.trace.exporters.ocagent import utils
31-
from opencensus.trace.exporters.transports import sync
3232

3333
# Default agent endpoint
3434
DEFAULT_ENDPOINT = 'localhost:55678'
@@ -57,7 +57,7 @@ class TraceExporter(base.Exporter):
5757
extend from the base :class:`.Transport` type and
5858
implement :meth:`.Transport.export`. Defaults to
5959
:class:`.SyncTransport`. The other option is
60-
:class:`.BackgroundThreadTransport`.
60+
:class:`.AsyncTransport`.
6161
"""
6262

6363
def __init__(

opencensus/trace/exporters/print_exporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
"""Export the trace spans by printing them out."""
1616

17+
from opencensus.common.transports import sync
1718
from opencensus.trace.exporters import base
18-
from opencensus.trace.exporters.transports import sync
1919

2020

2121
class PrintExporter(base.Exporter):
@@ -26,7 +26,7 @@ class PrintExporter(base.Exporter):
2626
extend from the base :class:`.Transport` type and
2727
implement :meth:`.Transport.export`. Defaults to
2828
:class:`.SyncTransport`. The other option is
29-
:class:`.BackgroundThreadTransport`.
29+
:class:`.AsyncTransport`.
3030
"""
3131

3232
def __init__(self, transport=sync.SyncTransport):

opencensus/trace/exporters/stackdriver_exporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
from opencensus.__version__ import __version__
2121
from opencensus.common.monitored_resource_util.monitored_resource_util \
2222
import MonitoredResourceUtil
23+
from opencensus.common.transports import sync
2324
from opencensus.trace import attributes_helper
2425
from opencensus.trace import span_data
2526
from opencensus.trace.attributes import Attributes
2627
from opencensus.trace.exporters import base
27-
from opencensus.trace.exporters.transports import sync
2828

2929
# Agent
3030
AGENT = 'opencensus-python [{}]'.format(__version__)
@@ -188,7 +188,7 @@ class StackdriverExporter(base.Exporter):
188188
extend from the base :class:`.Transport` type and
189189
implement :meth:`.Transport.export`. Defaults to
190190
:class:`.SyncTransport`. The other option is
191-
:class:`.BackgroundThreadTransport`.
191+
:class:`.AsyncTransport`.
192192
"""
193193

194194
def __init__(self, client=None, project_id=None,

opencensus/trace/exporters/transports/__init__.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)