MCPcopy Index your code
hub / github.com/codeaashu/claude-code / startToolPerfettoSpan

Function startToolPerfettoSpan

src/utils/telemetry/perfettoTracing.ts:690–722  ·  view source on GitHub ↗
(
  toolName: string,
  args?: Record<string, unknown>,
)

Source from the content-addressed store, hash-verified

688 * Start a tool execution span
689 */
690export function startToolPerfettoSpan(
691 toolName: string,
692 args?: Record<string, unknown>,
693): string {
694 if (!isEnabled) return ''
695
696 const spanId = generateSpanId()
697 const agentInfo = getCurrentAgentInfo()
698
699 pendingSpans.set(spanId, {
700 name: `Tool: ${toolName}`,
701 category: 'tool',
702 startTime: getTimestamp(),
703 agentInfo,
704 args: {
705 tool_name: toolName,
706 ...args,
707 },
708 })
709
710 // Emit begin event
711 events.push({
712 name: `Tool: ${toolName}`,
713 cat: 'tool',
714 ph: 'B',
715 ts: pendingSpans.get(spanId)!.startTime,
716 pid: agentInfo.processId,
717 tid: agentInfo.threadId,
718 args: pendingSpans.get(spanId)!.args,
719 })
720
721 return spanId
722}
723
724/**
725 * End a tool execution span

Callers 1

startToolSpanFunction · 0.85

Calls 6

generateSpanIdFunction · 0.85
getCurrentAgentInfoFunction · 0.85
getTimestampFunction · 0.85
getMethod · 0.65
setMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected