Open
Description
Which component is this bug for?
Traceloop SDK
📜 Description
When both a custom SpanProcessor
and SpanExporter
are passed to Traceloop.init()
, the exporter is silently ignored. This leads to unexpected behavior: the processor is invoked, but the exporter is never called.
👟 Reproduction steps
- Create a fresh virtual environment.
- Install the SDK
pip install traceloop-sdk==0.40.14
- Run the following code:
from typing import Sequence
from opentelemetry.sdk.trace import ReadableSpan
from opentelemetry.sdk.trace.export import SpanExporter, SpanProcessor, SpanExportResult
from opentelemetry.trace import Span
from traceloop.sdk import Traceloop
from traceloop.sdk.decorators import workflow
class MySpanProcessor(SpanProcessor):
def __init__(self):
self.call_count = 0
def on_start(self, span: Span, parent_context):
self.call_count += 1
print("MySpanProcessor")
class MySpanExporter(SpanExporter):
def __init__(self):
self.call_count = 0
def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
self.call_count += 1
print("MySpanExporter")
return SpanExportResult.SUCCESS
@workflow()
def run_workflow():
pass
my_proc = MySpanProcessor()
my_export = MySpanExporter()
Traceloop.init(processor=my_proc, exporter=my_export)
run_workflow()
assert my_proc.call_count > 0, "Expected MySpanProcessor to be called"
assert my_export.call_count > 0, "Expected MySpanExporter to be called"
- Observe that the second assert fails:
AssertionError: Expected MySpanExporter to be called
👍 Expected behavior
-
Either support combining a custom processor and exporter by internally wiring them,
or
-
Raise an error or warning when both are provided to avoid confusion.
👎 Actual Behavior with Screenshots
See Reproduction steps
🤖 Python Version
No response
📃 Provide any additional context for the Bug.
No response
👀 Have you spent some time to check if this bug has been raised before?
- I checked and didn't find similar issue
Are you willing to submit PR?
None
Metadata
Metadata
Assignees
Labels
No labels