Skip to content

Commit d47653e

Browse files
committed
push
1 parent f1fbaa5 commit d47653e

4 files changed

Lines changed: 6 additions & 59 deletions

File tree

langfuse/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
LangfuseTool,
3030
)
3131
from .span_filter import (
32-
KNOWN_LLM_INSTRUMENTATION_SCOPES,
3332
KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES,
3433
is_default_export_span,
3534
is_genai_span,
@@ -67,7 +66,6 @@
6766
"is_langfuse_span",
6867
"is_genai_span",
6968
"is_known_llm_instrumentor",
70-
"KNOWN_LLM_INSTRUMENTATION_SCOPES",
7169
"KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES",
7270
"experiment",
7371
"api",

langfuse/_client/span_filter.py

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,50 +8,27 @@
88

99
from langfuse._client.constants import LANGFUSE_TRACER_NAME
1010

11-
KNOWN_LLM_INSTRUMENTATION_SCOPES = frozenset(
11+
KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES = frozenset(
1212
{
1313
LANGFUSE_TRACER_NAME,
14-
"@arizeai/openinference-instrumentation-anthropic",
1514
"agent_framework",
1615
"ai",
1716
"haystack",
1817
"langsmith",
1918
"litellm",
20-
"openinference.instrumentation.agno",
21-
"openinference.instrumentation.beeai",
22-
"openinference.instrumentation.google_adk",
23-
"openinference.instrumentation.google_genai",
24-
"openinference.instrumentation.groq",
25-
"openinference.instrumentation.llama_index",
26-
"openinference.instrumentation.openai_agents",
27-
"openinference.instrumentation.smolagents",
19+
"openinference",
2820
"opentelemetry.instrumentation.anthropic",
2921
"strands-agents",
30-
"vllm.llm_engine",
31-
}
32-
)
33-
"""Known instrumentation scope names that should be export candidates."""
34-
35-
KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES = frozenset(
36-
{
37-
"litellm",
38-
"openinference.instrumentation.agno",
39-
"openinference.instrumentation.beeai",
40-
"openinference.instrumentation.google_adk",
41-
"openinference.instrumentation.google_genai",
42-
"openinference.instrumentation.groq",
43-
"openinference.instrumentation.llama_index",
44-
"openinference.instrumentation.openai_agents",
45-
"openinference.instrumentation.smolagents",
46-
"opentelemetry.instrumentation.anthropic",
47-
"vllm.llm_engine",
22+
"vllm",
4823
}
4924
)
5025
"""Known instrumentation scope namespace prefixes.
5126
5227
Prefix matching is boundary-aware:
5328
- exact match (``scope == prefix``)
5429
- direct descendant scopes (``scope.startswith(prefix + ".")``)
30+
31+
Please create a Github issue in https://github.com/langfuse/langfuse if you'd like to expand this default allow list.
5532
"""
5633

5734

@@ -69,7 +46,7 @@ def is_genai_span(span: ReadableSpan) -> bool:
6946
return False
7047

7148
return any(
72-
isinstance(key, str) and key.startswith("gen_ai.")
49+
isinstance(key, str) and key.startswith("gen_ai")
7350
for key in span.attributes.keys()
7451
)
7552

@@ -86,9 +63,6 @@ def is_known_llm_instrumentor(span: ReadableSpan) -> bool:
8663

8764
scope_name = span.instrumentation_scope.name
8865

89-
if scope_name in KNOWN_LLM_INSTRUMENTATION_SCOPES:
90-
return True
91-
9266
return any(
9367
_matches_scope_prefix(scope_name, prefix)
9468
for prefix in KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES

langfuse/span_filter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""Public span filter helpers for Langfuse OpenTelemetry export control."""
22

33
from langfuse._client.span_filter import (
4-
KNOWN_LLM_INSTRUMENTATION_SCOPES,
54
KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES,
65
is_default_export_span,
76
is_genai_span,
@@ -14,6 +13,5 @@
1413
"is_langfuse_span",
1514
"is_genai_span",
1615
"is_known_llm_instrumentor",
17-
"KNOWN_LLM_INSTRUMENTATION_SCOPES",
1816
"KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES",
1917
]

tests/test_span_filter.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from typing import Any, Optional
55

66
from langfuse.span_filter import (
7-
KNOWN_LLM_INSTRUMENTATION_SCOPES,
8-
KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES,
97
is_default_export_span,
108
is_genai_span,
119
is_known_llm_instrumentor,
@@ -77,21 +75,6 @@ def test_is_known_llm_instrumentor_prefix_match():
7775
)
7876

7977

80-
def test_is_known_llm_instrumentor_prefix_boundary():
81-
"""Return false when a scope only partially matches a namespace prefix."""
82-
assert (
83-
is_known_llm_instrumentor(
84-
_make_span(scope_name="openinference.instrumentation.agno2")
85-
)
86-
is False
87-
)
88-
89-
90-
def test_is_known_llm_instrumentor_ai_is_exact_only():
91-
"""Return false for descendants of exact-only allowlist scopes."""
92-
assert is_known_llm_instrumentor(_make_span(scope_name="ai.runtime")) is False
93-
94-
9578
def test_is_known_llm_instrumentor_unknown():
9679
"""Return false for unknown instrumentation scopes."""
9780
assert is_known_llm_instrumentor(_make_span(scope_name="unknown.scope")) is False
@@ -127,9 +110,3 @@ def test_is_default_export_span_rejects_unknown():
127110
)
128111
is False
129112
)
130-
131-
132-
def test_known_scope_constants_include_vercel_ai():
133-
"""Contain ai in exact allowlist constants for Vercel AI SDK support."""
134-
assert "ai" in KNOWN_LLM_INSTRUMENTATION_SCOPES
135-
assert "ai" not in KNOWN_LLM_INSTRUMENTATION_SCOPE_PREFIXES

0 commit comments

Comments
 (0)