Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ def __init__(
"Span",
)

# Added for backward compatibility. Not recommended to directly access/use underlying exporter.
@property
def span_exporter(self):
return self._batch_processor._exporter # pylint: disable=protected-access

def on_start(
self, span: Span, parent_context: Context | None = None
) -> None:
Expand Down
5 changes: 5 additions & 0 deletions opentelemetry-sdk/tests/trace/export/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ def test_simple_span_processor_not_sampled(self):
# before the end of the test, otherwise the worker thread will continue
# to run after the end of the test.
class TestBatchSpanProcessor(unittest.TestCase):
def test_get_span_exporter(self):
exporter = MySpanExporter(destination=[])
batch_span_processor = export.BatchSpanProcessor(exporter)
self.assertEqual(exporter, batch_span_processor.span_exporter)

@mock.patch.dict(
"os.environ",
{
Expand Down
Loading