mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-16 09:22:22 +00:00
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>
This commit is contained in:
parent
e46858b5ee
commit
4a075423a9
2 changed files with 0 additions and 15 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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")]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue