From 4a075423a93e264fb867e6bc953d4075b8f3372e Mon Sep 17 00:00:00 2001 From: yucheng Date: Sat, 12 Sep 2026 19:26:38 +0000 Subject: [PATCH] refactor(otel v2): drop explanatory docstrings from the langfuse exporter filter Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/integrations/otel/plumbing/providers.py | 9 --------- .../integrations/otel/test_otel_v2_multibackend.py | 6 ------ 2 files changed, 15 deletions(-) diff --git a/litellm/integrations/otel/plumbing/providers.py b/litellm/integrations/otel/plumbing/providers.py index 24595a66628..9f815b76aa6 100644 --- a/litellm/integrations/otel/plumbing/providers.py +++ b/litellm/integrations/otel/plumbing/providers.py @@ -502,12 +502,6 @@ def _without_langfuse_attributes(span: ReadableSpan) -> ReadableSpan: def _reads_langfuse_attributes(spec: ExporterSpec, config: OpenTelemetryV2Config) -> bool: - """Whether ``spec`` is the sink the ``langfuse.*`` attributes on a span are meant for. - - An unowned exporter is the operator's generic collector, unless the config runs the - ``langfuse`` mapper with no Langfuse-owned exporter to deliver it (the mapper pointed - at ``OTEL_EXPORTER_*`` directly). - """ if spec.owner is not None: return spec.owner is ExporterOwner.LANGFUSE_OTEL return "langfuse" in config.mapper_names and all( @@ -803,9 +797,6 @@ class _OverriddenBackendFilter(SpanProcessor): class _LangfuseAttributeFilter(SpanProcessor): - """Strip the ``langfuse.*`` attributes a Langfuse callback stamps on the shared spans - before they reach an exporter that is not a Langfuse sink.""" - def __init__(self, inner: SpanProcessor) -> None: self._inner: Final = inner diff --git a/tests/test_litellm/integrations/otel/test_otel_v2_multibackend.py b/tests/test_litellm/integrations/otel/test_otel_v2_multibackend.py index dc5489db3f2..92b14324023 100644 --- a/tests/test_litellm/integrations/otel/test_otel_v2_multibackend.py +++ b/tests/test_litellm/integrations/otel/test_otel_v2_multibackend.py @@ -55,14 +55,12 @@ def test_two_exporters_receive_the_same_span(): def _capturing_kind(kind): - """Register ``kind`` so every ExporterSpec of that kind exports into one buffer.""" exporter = InMemorySpanExporter() register_exporter_factory(kind, lambda _spec: exporter) return exporter def _emit_langfuse_stamped_span(provider): - """The shared span both a generic ``otel`` and a ``langfuse_otel`` callback write to.""" span = provider.get_tracer("test").start_span("chat proof-model") span.set_attribute("gen_ai.request.model", "proof-model") span.set_attribute("langfuse.trace.name", "private-langfuse-only-name") @@ -72,8 +70,6 @@ def _emit_langfuse_stamped_span(provider): def test_generic_exporter_does_not_receive_langfuse_attributes_the_langfuse_exporter_keeps(): - """``otel`` + ``langfuse_otel`` together: the operator's own collector must see the - OTel GenAI vocabulary only, while the Langfuse sink keeps its trace name and I/O.""" generic = _capturing_kind("capture_generic_collector") langfuse = _capturing_kind("capture_langfuse_sink") cfg = OpenTelemetryV2Config( @@ -94,8 +90,6 @@ def test_generic_exporter_does_not_receive_langfuse_attributes_the_langfuse_expo def test_langfuse_mapper_on_a_plain_otlp_exporter_keeps_langfuse_attributes(): - """``otel`` alone with ``mapper_names: [langfuse]`` points the mapper at the operator's - exporter on purpose, so that exporter is the Langfuse sink and nothing is stripped.""" sink = _capturing_kind("capture_langfuse_mapper_sink") cfg = OpenTelemetryV2Config( mapper_names=["langfuse"], exporters=[ExporterSpec(kind="capture_langfuse_mapper_sink")]