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

Function endUserInputPerfettoSpan

src/utils/telemetry/perfettoTracing.ts:801–835  ·  view source on GitHub ↗
(
  spanId: string,
  metadata?: {
    decision?: string
    source?: string
  },
)

Source from the content-addressed store, hash-verified

799 * End a user input waiting span
800 */
801export function endUserInputPerfettoSpan(
802 spanId: string,
803 metadata?: {
804 decision?: string
805 source?: string
806 },
807): void {
808 if (!isEnabled || !spanId) return
809
810 const pending = pendingSpans.get(spanId)
811 if (!pending) return
812
813 const endTime = getTimestamp()
814 const duration = endTime - pending.startTime
815
816 const args = {
817 ...pending.args,
818 decision: metadata?.decision,
819 source: metadata?.source,
820 duration_ms: duration / 1000,
821 }
822
823 // Emit end event
824 events.push({
825 name: pending.name,
826 cat: pending.category,
827 ph: 'E',
828 ts: endTime,
829 pid: pending.agentInfo.processId,
830 tid: pending.agentInfo.threadId,
831 args,
832 })
833
834 pendingSpans.delete(spanId)
835}
836
837/**
838 * Emit an instant event (marker)

Callers 1

endToolBlockedOnUserSpanFunction · 0.85

Calls 4

getTimestampFunction · 0.85
getMethod · 0.65
deleteMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected