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

Commit cf70f02

Browse files
authored
Move built-in exporters to opencensus.trace (#551)
1. Renamed `opencensus.trace.exporters.base` to `opencensus.trace.base_exporter`. 2. Moved `opencensus.trace.exporters.file_exporter` to `opencensus.trace.file_exporter`. 3. Moved `opencensus.trace.exporters.logging_exporter` to `opencensus.trace.logging_exporter`. 4. Removed `opencensus.trace.exporters` namespace.
1 parent eff14fd commit cf70f02

34 files changed

Lines changed: 75 additions & 84 deletions

File tree

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ file:
132132

133133
.. code:: python
134134
135-
from opencensus.trace.exporters import file_exporter
135+
from opencensus.trace import file_exporter
136136
from opencensus.trace.tracers import context_tracer
137137
138138
exporter = file_exporter.FileExporter(file_name='traces')

contrib/opencensus-ext-django/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ You can configure the sampler, exporter, propagator using the ``OPENCENSUS_TRACE
3737
3838
OPENCENSUS_TRACE = {
3939
'SAMPLER': 'opencensus.trace.samplers.probability.ProbabilitySampler',
40-
'REPORTER': 'opencensus.trace.exporters.print_exporter.PrintExporter',
40+
'REPORTER': 'opencensus.trace.print_exporter.PrintExporter',
4141
'PROPAGATOR': 'opencensus.trace.propagation.google_cloud_format.'
4242
'GoogleCloudFormatPropagator',
4343
}

contrib/opencensus-ext-django/opencensus/ext/django/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
DEFAULT_DJANGO_TRACER_CONFIG = {
2121
'SAMPLER': 'opencensus.trace.samplers.always_on.AlwaysOnSampler',
2222
'EXPORTER':
23-
'opencensus.trace.exporters.print_exporter.PrintExporter',
23+
'opencensus.trace.print_exporter.PrintExporter',
2424
'PROPAGATOR': 'opencensus.trace.propagation.google_cloud_format.'
2525
'GoogleCloudFormatPropagator',
2626
}

contrib/opencensus-ext-django/tests/test_django_middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
from opencensus.ext.ocagent import trace_exporter as ocagent_exporter
2424
from opencensus.ext.zipkin import trace_exporter as zipkin_exporter
2525
from opencensus.trace import execution_context
26+
from opencensus.trace import print_exporter
2627
from opencensus.trace import span as span_module
2728
from opencensus.trace import utils
28-
from opencensus.trace.exporters import print_exporter
2929
from opencensus.trace.propagation import google_cloud_format
3030
from opencensus.trace.samplers import always_on
3131
from opencensus.trace.samplers import probability

contrib/opencensus-ext-flask/opencensus/ext/flask/flask_middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
from opencensus.common.transports import sync
2323
from opencensus.trace import attributes_helper
2424
from opencensus.trace import execution_context
25+
from opencensus.trace import print_exporter
2526
from opencensus.trace import span as span_module
2627
from opencensus.trace import stack_trace
2728
from opencensus.trace import status
2829
from opencensus.trace import tracer as tracer_module
2930
from opencensus.trace import utils
30-
from opencensus.trace.exporters import print_exporter
3131
from opencensus.trace.propagation import google_cloud_format
3232
from opencensus.trace.samplers import always_on, probability
3333

contrib/opencensus-ext-flask/tests/test_flask_middleware.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
from opencensus.ext.stackdriver import trace_exporter as stackdriver_exporter
2828
from opencensus.ext.zipkin import trace_exporter as zipkin_exporter
2929
from opencensus.trace import execution_context
30+
from opencensus.trace import print_exporter
3031
from opencensus.trace import span as span_module
3132
from opencensus.trace import span_data
3233
from opencensus.trace import stack_trace
3334
from opencensus.trace import status
3435
from opencensus.trace.blank_span import BlankSpan
35-
from opencensus.trace.exporters import print_exporter
3636
from opencensus.trace.propagation import google_cloud_format
3737
from opencensus.trace.samplers import always_off, always_on, ProbabilitySampler
3838
from opencensus.trace.span_context import SpanContext

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

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
from opencensus.common.transports import sync
2424
from opencensus.common.utils import timestamp_to_microseconds
2525
from opencensus.ext.jaeger.trace_exporter.gen.jaeger import agent, jaeger
26+
from opencensus.trace import base_exporter
2627
from opencensus.trace import link as link_module
27-
from opencensus.trace.exporters import base
2828

2929
DEFAULT_HOST_NAME = 'localhost'
3030
DEFAULT_AGENT_PORT = 6831
@@ -35,7 +35,7 @@
3535
logging = logging.getLogger(__name__)
3636

3737

38-
class JaegerExporter(base.Exporter):
38+
class JaegerExporter(base_exporter.Exporter):
3939
"""Exports the spans to Jaeger.
4040
4141
:type service_name: str
@@ -68,8 +68,8 @@ class JaegerExporter(base.Exporter):
6868
6969
:type transport: :class:`type`
7070
:param transport: Class for creating new transport objects. It should
71-
extend from the base :class:`.Transport` type and
72-
implement :meth:`.Transport.export`. Defaults to
71+
extend from the base_exporter :class:`.Transport` type
72+
and implement :meth:`.Transport.export`. Defaults to
7373
:class:`.SyncTransport`. The other option is
7474
:class:`.AsyncTransport`.
7575
"""
@@ -322,7 +322,7 @@ def _convert_attribute_to_tag(key, attr):
322322
return None
323323

324324

325-
class Collector(base.Exporter):
325+
class Collector(base_exporter.Exporter):
326326
"""Submits collected spans to Thrift HTTP server.
327327
328328
:type thrift_url: str
@@ -334,8 +334,8 @@ class Collector(base.Exporter):
334334
335335
:type transport: :class:`type`
336336
:param transport: Class for creating new transport objects. It should
337-
extend from the base :class:`.Transport` type and
338-
implement :meth:`.Transport.export`. Defaults to
337+
extend from the base_exporter :class:`.Transport` type
338+
and implement :meth:`.Transport.export`. Defaults to
339339
:class:`.SyncTransport`. The other option is
340340
:class:`.AsyncTransport`.
341341
@@ -369,7 +369,8 @@ def __init__(
369369
def emit(self, batch):
370370
"""Submits batches to Thrift HTTP Server through Binary Protocol.
371371
372-
:type batch: :class: `~opencensus.trace.exporters.gen.jaeger.Batch`
372+
:type batch:
373+
:class:`~opencensus.ext.jaeger.trace_exporter.gen.jaeger.Batch`
373374
:param batch: Object to emit Jaeger spans.
374375
"""
375376
try:
@@ -390,13 +391,14 @@ def emit(self, batch):
390391

391392
def export(self, batch):
392393
"""
393-
:type batch: :class: `~opencensus.trace.exporters.gen.jaeger.Batch`
394+
:type batch: :class:
395+
`~opencensus.ext.jaeger.trace_exporter.gen.jaeger.Batch`
394396
:param batch: Object to export Jaeger spans.
395397
"""
396398
self.transport.export(batch)
397399

398400

399-
class AgentClientUDP(base.Exporter):
401+
class AgentClientUDP(base_exporter.Exporter):
400402
"""Implement a UDP client to agent.
401403
402404
:type host_name: str
@@ -416,8 +418,8 @@ class AgentClientUDP(base.Exporter):
416418
417419
:type transport: :class:`type`
418420
:param transport: Class for creating new transport objects. It should
419-
extend from the base :class:`.Transport` type and
420-
implement :meth:`.Transport.export`. Defaults to
421+
extend from the base_exporter :class:`.Transport` type
422+
and implement :meth:`.Transport.export`. Defaults to
421423
:class:`.SyncTransport`. The other option is
422424
:class:`.AsyncTransport`.
423425
"""
@@ -438,7 +440,8 @@ def __init__(
438440

439441
def emit(self, batch):
440442
"""
441-
:type batch: :class: `~opencensus.trace.exporters.gen.jaeger.Batch`
443+
:type batch:
444+
:class:`~opencensus.ext.jaeger.trace_exporter.gen.jaeger.Batch`
442445
:param batch: Object to emit Jaeger spans.
443446
"""
444447
udp_socket = None
@@ -465,7 +468,8 @@ def emit(self, batch):
465468

466469
def export(self, batch):
467470
"""
468-
:type batch: :class: `~opencensus.trace.exporters.gen.jaeger.Batch`
471+
:type batch:
472+
:class:`~opencensus.ext.jaeger.trace_exporter.gen.jaeger.Batch`
469473
:param batch: Object to export Jaeger spans.
470474
"""
471475
self.transport.export(batch)

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import trace_service_pb2
2929
from opencensus.ext.ocagent.trace_exporter.gen.opencensus.agent.trace.v1 \
3030
import trace_service_pb2_grpc
31-
from opencensus.trace.exporters import base
31+
from opencensus.trace import base_exporter
3232

3333
# Default agent endpoint
3434
DEFAULT_ENDPOINT = 'localhost:55678'
@@ -37,7 +37,7 @@
3737
EXPORTER_VERSION = '0.0.1'
3838

3939

40-
class TraceExporter(base.Exporter):
40+
class TraceExporter(base_exporter.Exporter):
4141
"""Export the spans by sending them to opencensus agent.
4242
4343
:type service_name: str
@@ -54,8 +54,8 @@ class TraceExporter(base.Exporter):
5454
5555
:type transport: :class:`type`
5656
:param transport: Class for creating new transport objects. It should
57-
extend from the base :class:`.Transport` type and
58-
implement :meth:`.Transport.export`. Defaults to
57+
extend from the base_exporter :class:`.Transport` type
58+
and implement :meth:`.Transport.export`. Defaults to
5959
:class:`.SyncTransport`. The other option is
6060
:class:`.AsyncTransport`.
6161
"""

contrib/opencensus-ext-pyramid/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ into the pyramid settings
2727

2828
.. code:: python
2929
30-
from opencensus.trace.exporters import print_exporter
30+
from opencensus.trace import print_exporter
3131
from opencensus.trace.propagation import google_cloud_format
3232
from opencensus.trace.samplers import probability
3333

contrib/opencensus-ext-pyramid/examples/simple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from wsgiref.simple_server import make_server
1616

1717
from opencensus.trace import config_integration
18-
from opencensus.trace.exporters import print_exporter
18+
from opencensus.trace import print_exporter
1919
from opencensus.trace.samplers import probability
2020

2121
from app import main

0 commit comments

Comments
 (0)