MCPcopy Index your code
hub / github.com/simstudioai/sim / startSpan

Method startSpan

apps/sim/lib/copilot/request/trace.ts:17–41  ·  view source on GitHub ↗
(
    name: string,
    kind: string,
    attributes?: Record<string, unknown>,
    parent?: RequestTraceV1Span
  )

Source from the content-addressed store, hash-verified

15 private activeSpan?: RequestTraceV1Span
16
17 startSpan(
18 name: string,
19 kind: string,
20 attributes?: Record<string, unknown>,
21 parent?: RequestTraceV1Span
22 ): RequestTraceV1Span {
23 const startMs = Date.now()
24 const span: RequestTraceV1Span = {
25 name,
26 kind,
27 startMs,
28 endMs: startMs,
29 durationMs: 0,
30 status: RequestTraceV1SpanStatus.ok,
31 source: RequestTraceV1SpanSource.sim,
32 ...(parent
33 ? { parentName: parent.name }
34 : this.activeSpan
35 ? { parentName: this.activeSpan.name }
36 : {}),
37 ...(attributes && Object.keys(attributes).length > 0 ? { attributes } : {}),
38 }
39 this.spans.push(span)
40 return span
41 }
42
43 endSpan(
44 span: RequestTraceV1Span,

Callers 15

trackPlatformEventFunction · 0.80
withDbSpanFunction · 0.80
startCopilotOtelRootFunction · 0.80
withCopilotOtelContextFunction · 0.80
startFunction · 0.80
runCheckpointLoopFunction · 0.80
finalizeStreamFunction · 0.80
runStreamLoopFunction · 0.80

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected