Skip to content

Add start_time to .start_span() and start_obervation() methods as input argument #1377

Description

@mdciri

Hello, I need to create manually a langfuse trace after I created an opentelemetry output saved in a json file (I created a custom exporter). The opentelemetry output is a list of disctionaries that look exactly like those in here.

Each opentelemetry span/observation has start_time and end_time field, but the methods .start_span() and .start_observation() do not have as input argument a start_time timestamp. Whereas there is the possibility to end the span/observation with the method end() that takes as input a timestamp.

from langfuse import get_client
 
langfuse = get_client()
trace_id = langfuse.create_trace_id()

my_otel_spans = [....]
root_otel_span = my_otel_spans[0]
child_otel_span =  my_otel_spans[1]

root = langfuse.start_span(name=root_otel_span["name"], ...)
child = span.start_observation(name=child_otel_span["name"], ...)

child.end(end_time=child_otel_span["end_time"])
root.end(end_time=root_otel_span["end_time"])

May you, please, add the stat_time timestamp into such methods? If you add such argument, then the latency for each span/observation should be correct. The field may be optional, so it would not change the default flow.
Thanks in advance for your attention.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions