Skip to content

Commit

Permalink
Remove deprecated transports (#452)
Browse files Browse the repository at this point in the history
Replace trace transports with common transports, increasing default batch size
and changing behavior on exit.
  • Loading branch information
kornholi authored and c24t committed Jan 17, 2019
1 parent 989470e commit 2857864
Show file tree
Hide file tree
Showing 22 changed files with 36 additions and 677 deletions.
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,12 @@ This example shows how to configure Census to use a background thread:

.. code:: python
from opencensus.common.transport.async_ import AsyncTransport
from opencensus.trace.exporters import stackdriver_exporter
from opencensus.trace import tracer as tracer_module
from opencensus.trace.exporters.transports.background_thread \
import BackgroundThreadTransport
exporter = stackdriver_exporter.StackdriverExporter(
project_id='your_cloud_project', transport=BackgroundThreadTransport)
project_id='your_cloud_project', transport=AsyncTransport)
tracer = tracer_module.Tracer(exporter=exporter)
Propagators
Expand Down
2 changes: 1 addition & 1 deletion opencensus/common/transports/async_.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from opencensus.common.transports import base

_DEFAULT_GRACE_PERIOD = 5.0 # Seconds
_DEFAULT_MAX_BATCH_SIZE = 200
_DEFAULT_MAX_BATCH_SIZE = 600
_WAIT_PERIOD = 60.0 # Seconds
_WORKER_THREAD_NAME = 'opencensus.common.Worker'
_WORKER_TERMINATOR = object()
Expand Down
4 changes: 2 additions & 2 deletions opencensus/trace/exporters/file_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import json

from opencensus.common.transports import sync
from opencensus.trace import span_data
from opencensus.trace.exporters import base
from opencensus.trace.exporters.transports import sync

DEFAULT_FILENAME = 'opencensus-traces.json'

Expand All @@ -33,7 +33,7 @@ class FileExporter(base.Exporter):
extend from the base :class:`.Transport` type and
implement :meth:`.Transport.export`. Defaults to
:class:`.SyncTransport`. The other option is
:class:`.BackgroundThreadTransport`.
:class:`.AsyncTransport`.
:type file_mode: str
:param file_mode: The file mode to open the output file with.
Expand Down
8 changes: 4 additions & 4 deletions opencensus/trace/exporters/jaeger_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
from thrift.protocol import TBinaryProtocol, TCompactProtocol
from thrift.transport import THttpClient, TTransport

from opencensus.common.transports import sync
from opencensus.common.utils import timestamp_to_microseconds
from opencensus.trace import link as link_module
from opencensus.trace.exporters import base
from opencensus.trace.exporters.gen.jaeger import agent, jaeger
from opencensus.trace.exporters.transports import sync

DEFAULT_HOST_NAME = 'localhost'
DEFAULT_AGENT_PORT = 6831
Expand Down Expand Up @@ -71,7 +71,7 @@ class JaegerExporter(base.Exporter):
extend from the base :class:`.Transport` type and
implement :meth:`.Transport.export`. Defaults to
:class:`.SyncTransport`. The other option is
:class:`.BackgroundThreadTransport`.
:class:`.AsyncTransport`.
"""

def __init__(
Expand Down Expand Up @@ -332,7 +332,7 @@ class Collector(base.Exporter):
extend from the base :class:`.Transport` type and
implement :meth:`.Transport.export`. Defaults to
:class:`.SyncTransport`. The other option is
:class:`.BackgroundThreadTransport`.
:class:`.AsyncTransport`.
:type http_transport: :class:`type`
:param http_transport: Class for creating new client for Thrift
Expand Down Expand Up @@ -414,7 +414,7 @@ class AgentClientUDP(base.Exporter):
extend from the base :class:`.Transport` type and
implement :meth:`.Transport.export`. Defaults to
:class:`.SyncTransport`. The other option is
:class:`.BackgroundThreadTransport`.
:class:`.AsyncTransport`.
"""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions opencensus/trace/exporters/logging_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import logging

from opencensus.common.transports import sync
from opencensus.trace import span_data
from opencensus.trace.exporters import base
from opencensus.trace.exporters.transports import sync


class LoggingExporter(base.Exporter):
Expand All @@ -33,7 +33,7 @@ class LoggingExporter(base.Exporter):
extend from the base :class:`.Transport` type and
implement :meth:`.Transport.export`. Defaults to
:class:`.SyncTransport`. The other option is
:class:`.BackgroundThreadTransport`.
:class:`.AsyncTransport`.
Example:
Expand Down
4 changes: 2 additions & 2 deletions opencensus/trace/exporters/ocagent/trace_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import socket

from opencensus.__version__ import __version__
from opencensus.common.transports import sync
from opencensus.trace.exporters import base
from opencensus.trace.exporters.gen.opencensus.agent.common.v1 \
import common_pb2
Expand All @@ -28,7 +29,6 @@
from opencensus.trace.exporters.gen.opencensus.agent.trace.v1 \
import trace_service_pb2_grpc
from opencensus.trace.exporters.ocagent import utils
from opencensus.trace.exporters.transports import sync

# Default agent endpoint
DEFAULT_ENDPOINT = 'localhost:55678'
Expand Down Expand Up @@ -57,7 +57,7 @@ class TraceExporter(base.Exporter):
extend from the base :class:`.Transport` type and
implement :meth:`.Transport.export`. Defaults to
:class:`.SyncTransport`. The other option is
:class:`.BackgroundThreadTransport`.
:class:`.AsyncTransport`.
"""

def __init__(
Expand Down
4 changes: 2 additions & 2 deletions opencensus/trace/exporters/print_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

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

from opencensus.common.transports import sync
from opencensus.trace.exporters import base
from opencensus.trace.exporters.transports import sync


class PrintExporter(base.Exporter):
Expand All @@ -26,7 +26,7 @@ class PrintExporter(base.Exporter):
extend from the base :class:`.Transport` type and
implement :meth:`.Transport.export`. Defaults to
:class:`.SyncTransport`. The other option is
:class:`.BackgroundThreadTransport`.
:class:`.AsyncTransport`.
"""

def __init__(self, transport=sync.SyncTransport):
Expand Down
4 changes: 2 additions & 2 deletions opencensus/trace/exporters/stackdriver_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
from opencensus.__version__ import __version__
from opencensus.common.monitored_resource_util.monitored_resource_util \
import MonitoredResourceUtil
from opencensus.common.transports import sync
from opencensus.trace import attributes_helper
from opencensus.trace import span_data
from opencensus.trace.attributes import Attributes
from opencensus.trace.exporters import base
from opencensus.trace.exporters.transports import sync

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

def __init__(self, client=None, project_id=None,
Expand Down
13 changes: 0 additions & 13 deletions opencensus/trace/exporters/transports/__init__.py

This file was deleted.

Loading

0 comments on commit 2857864

Please sign in to comment.