88
99from 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
5227Prefix 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
0 commit comments