Adding Multiple Span Processors with LangChain Instrumentor in Python
Need some help in adding 2 span processors:
px.launch_app()
# Phoenix and OpenTelemetry setup
tracer_provider = register(
project_name="default",
endpoint="http://localhost:6006/v1/traces"
)
# Then add the console exporter to the existing tracer provider
console_exporter = ConsoleSpanExporter()
console_processor = SimpleSpanProcessor(console_exporter)
tracer_provider.add_span_processor(console_processor)
LangChainInstrumentor().instrument()
I wanted the spans to be exported at 2 places with the langchain instrumentor but when I look at the add_span_processor function, I see its overiding:
def add_span_processor(self, *args: Any, **kwargs: Any) -> None:
"""
Registers a new `SpanProcessor` for this `TracerProvider`.
If this `TracerProvider` has a default processor, it will be removed.
"""
if self._default_processor:
self._active_span_processor.shutdown()
self._active_span_processor._span_processors = tuple() # remove default processors
self._default_processor = False
return super().add_span_processor(*args, **kwargs)Not sure why is it done ? Any help would be appreciated. John G., incase you help me with a example.
