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

Function startToolExecutionSpan

src/utils/telemetry/sessionTracing.ts:626–655  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

624}
625
626export function startToolExecutionSpan(): Span {
627 if (!isAnyTracingEnabled()) {
628 return trace.getActiveSpan() || getTracer().startSpan('dummy')
629 }
630
631 const tracer = getTracer()
632 const parentSpanCtx = toolContext.getStore()
633
634 const attributes = createSpanAttributes('tool.execution')
635
636 const ctx = parentSpanCtx
637 ? trace.setSpan(otelContext.active(), parentSpanCtx.span)
638 : otelContext.active()
639 const span = tracer.startSpan(
640 'claude_code.tool.execution',
641 { attributes },
642 ctx,
643 )
644
645 const spanId = getSpanId(span)
646 const spanContextObj: SpanContext = {
647 span,
648 startTime: Date.now(),
649 attributes,
650 }
651 activeSpans.set(spanId, new WeakRef(spanContextObj))
652 strongSpans.set(spanId, spanContextObj)
653
654 return span
655}
656
657export function endToolExecutionSpan(metadata?: {
658 success?: boolean

Callers 1

Calls 6

isAnyTracingEnabledFunction · 0.85
getTracerFunction · 0.85
createSpanAttributesFunction · 0.85
getSpanIdFunction · 0.85
activeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected