MCPcopy
hub / github.com/codeaashu/claude-code / closeOpenSpans

Function closeOpenSpans

src/utils/telemetry/perfettoTracing.ts:965–983  ·  view source on GitHub ↗

* Force-close any remaining open spans at session end.

()

Source from the content-addressed store, hash-verified

963 * Force-close any remaining open spans at session end.
964 */
965function closeOpenSpans(): void {
966 for (const [spanId, pending] of pendingSpans) {
967 const endTime = getTimestamp()
968 events.push({
969 name: pending.name,
970 cat: pending.category,
971 ph: 'E',
972 ts: endTime,
973 pid: pending.agentInfo.processId,
974 tid: pending.agentInfo.threadId,
975 args: {
976 ...pending.args,
977 incomplete: true,
978 duration_ms: (endTime - pending.startTime) / 1000,
979 },
980 })
981 pendingSpans.delete(spanId)
982 }
983}
984
985/**
986 * Write the full trace to disk. Errors are logged but swallowed so that a

Callers 2

writePerfettoTraceFunction · 0.85
writePerfettoTraceSyncFunction · 0.85

Calls 3

getTimestampFunction · 0.85
deleteMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected