Skip to content

Commit cb9cc7a

Browse files
authored
chore(client): add check for tracing setting (#1269)
1 parent ec881c2 commit cb9cc7a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

langfuse/_client/client.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,11 @@ def get_current_trace_id(self) -> Optional[str]:
16391639
external_system.process(data, trace_id=trace_id)
16401640
```
16411641
"""
1642+
if not self._tracing_enabled:
1643+
langfuse_logger.debug(
1644+
"Operation skipped: get_current_trace_id - Tracing is disabled or client is in no-op mode."
1645+
)
1646+
return
16421647
current_otel_span = self._get_current_otel_span()
16431648

16441649
return self._get_otel_trace_id(current_otel_span) if current_otel_span else None
@@ -1666,6 +1671,11 @@ def get_current_observation_id(self) -> Optional[str]:
16661671
# Process the query...
16671672
```
16681673
"""
1674+
if not self._tracing_enabled:
1675+
langfuse_logger.debug(
1676+
"Operation skipped: get_current_observation_id - Tracing is disabled or client is in no-op mode."
1677+
)
1678+
return
16691679
current_otel_span = self._get_current_otel_span()
16701680

16711681
return self._get_otel_span_id(current_otel_span) if current_otel_span else None

0 commit comments

Comments
 (0)