MCPcopy
hub / github.com/microsoft/agent-lightning / build_span

Function build_span

tests/store/test_core.py:1610–1630  ·  view source on GitHub ↗
(idx: int, *, name: str, parent: Optional[str])

Source from the content-addressed store, hash-verified

1608 attempt_id = attempted.attempt.attempt_id
1609
1610 def build_span(idx: int, *, name: str, parent: Optional[str]) -> Span:
1611 trace_hex = f"{idx:032x}"
1612 span_hex = f"{idx:016x}"
1613 return Span(
1614 rollout_id=attempted.rollout_id,
1615 attempt_id=attempt_id,
1616 sequence_id=idx,
1617 trace_id=trace_hex,
1618 span_id=span_hex,
1619 parent_id=parent,
1620 name=name,
1621 status=TraceStatus(status_code="OK"),
1622 attributes={},
1623 events=[Event(name=f"event-{idx}", attributes={})],
1624 links=[],
1625 start_time=None,
1626 end_time=None,
1627 context=SpanContext(trace_id=trace_hex, span_id=span_hex, is_remote=False, trace_state={}),
1628 parent=None,
1629 resource=OtelResource(attributes={}, schema_url=""),
1630 )
1631
1632 created_spans = [
1633 build_span(1, name="reward", parent=None),

Calls 5

SpanClass · 0.90
TraceStatusClass · 0.90
EventClass · 0.90
SpanContextClass · 0.90
OtelResourceClass · 0.90

Tested by

no test coverage detected