Skip to content

Commit b4d3ab9

Browse files
authored
perf(decorator): remove get_caller_module (#1074)
1 parent 7497b3e commit b4d3ab9

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

langfuse/decorators/langfuse_decorator.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -676,26 +676,12 @@ def get_current_trace_id(self):
676676
return context_trace_id
677677

678678
stack = _observation_stack_context.get()
679-
should_log_warning = self._get_caller_module_name() != "langfuse.openai"
680679

681680
if not stack:
682-
if should_log_warning:
683-
self._log.warning("No trace found in the current context")
684-
685681
return None
686682

687683
return stack[0].id
688684

689-
def _get_caller_module_name(self):
690-
try:
691-
caller_module = inspect.getmodule(inspect.stack()[2][0])
692-
except Exception as e:
693-
self._log.warning(f"Failed to get caller module: {e}")
694-
695-
return None
696-
697-
return caller_module.__name__ if caller_module else None
698-
699685
def get_current_trace_url(self) -> Optional[str]:
700686
"""Retrieve the URL of the current trace in context.
701687
@@ -738,12 +724,8 @@ def get_current_observation_id(self):
738724
- If called at the top level of a trace, it will return the trace ID.
739725
"""
740726
stack = _observation_stack_context.get()
741-
should_log_warning = self._get_caller_module_name() != "langfuse.openai"
742727

743728
if not stack:
744-
if should_log_warning:
745-
self._log.warning("No observation found in the current context")
746-
747729
return None
748730

749731
return stack[-1].id

0 commit comments

Comments
 (0)