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

Function _make_span

tests/benchmark/micro_benchmark.py:46–73  ·  view source on GitHub ↗
(rollout_id: str, attempt_id: str, sequence_id: int, name: str, attribute_size: int)

Source from the content-addressed store, hash-verified

44
45
46def _make_span(rollout_id: str, attempt_id: str, sequence_id: int, name: str, attribute_size: int) -> Span:
47 trace_hex = f"{sequence_id:032x}"
48 span_hex = f"{sequence_id:016x}"
49 return Span(
50 rollout_id=rollout_id,
51 attempt_id=attempt_id,
52 sequence_id=sequence_id,
53 trace_id=trace_hex,
54 span_id=span_hex,
55 parent_id=None,
56 name=name,
57 status=TraceStatus(status_code="OK"),
58 attributes=flatten_dict(
59 random_dict(
60 depth=1,
61 breadth=attribute_size,
62 key_length=(3, 20),
63 value_length=(5, 300),
64 )
65 ),
66 events=[],
67 links=[],
68 start_time=None,
69 end_time=None,
70 context=SpanContext(trace_id=trace_hex, span_id=span_hex, is_remote=False, trace_state={}),
71 parent=None,
72 resource=OtelResource(attributes={}, schema_url=""),
73 )
74
75
76@dataclass

Callers 1

_async_taskFunction · 0.70

Calls 6

SpanClass · 0.90
TraceStatusClass · 0.90
SpanContextClass · 0.90
OtelResourceClass · 0.90
flatten_dictFunction · 0.85
random_dictFunction · 0.85

Tested by

no test coverage detected