Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions langfuse/_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,8 @@ def _create_observation_id(self, *, seed: Optional[str] = None) -> str:

return sha256(seed.encode("utf-8")).digest()[:8].hex()

def create_trace_id(self, *, seed: Optional[str] = None) -> str:
@staticmethod
def create_trace_id(*, seed: Optional[str] = None) -> str:
"""Create a unique trace ID for use with Langfuse.

This method generates a unique trace ID for use with various Langfuse APIs.
Expand Down Expand Up @@ -1164,7 +1165,7 @@ def create_trace_id(self, *, seed: Optional[str] = None) -> str:
if not seed:
trace_id_int = RandomIdGenerator().generate_trace_id()

return self._format_otel_trace_id(trace_id_int)
return Langfuse._format_otel_trace_id(trace_id_int)

return sha256(seed.encode("utf-8")).digest()[:16].hex()

Expand All @@ -1178,7 +1179,8 @@ def _get_otel_span_id(self, otel_span: otel_trace_api.Span):

return self._format_otel_span_id(span_context.span_id)

def _format_otel_span_id(self, span_id_int: int) -> str:
@staticmethod
def _format_otel_span_id(span_id_int: int) -> str:
"""Format an integer span ID to a 16-character lowercase hex string.

Internal method to convert an OpenTelemetry integer span ID to the standard
Expand All @@ -1192,7 +1194,8 @@ def _format_otel_span_id(self, span_id_int: int) -> str:
"""
return format(span_id_int, "016x")

def _format_otel_trace_id(self, trace_id_int: int) -> str:
@staticmethod
def _format_otel_trace_id(trace_id_int: int) -> str:
"""Format an integer trace ID to a 32-character lowercase hex string.

Internal method to convert an OpenTelemetry integer trace ID to the standard
Expand Down Expand Up @@ -1482,9 +1485,6 @@ def score_current_trace(
config_id=config_id,
)

def update_finished_trace(self):
pass

def flush(self):
"""Force flush all pending spans and events to the Langfuse API.

Expand Down
4 changes: 2 additions & 2 deletions langfuse/_client/span.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,8 +1140,8 @@ def __init__(
Args:
otel_span: The OpenTelemetry span to wrap
langfuse_client: Reference to the parent Langfuse client
input: Input data for the generation (e.g., prompts)
output: Output from the generation (e.g., completions)
input: Input data for the event
output: Output from the event
metadata: Additional metadata to associate with the generation
environment: The tracing environment
"""
Expand Down
Loading