MCPcopy
hub / github.com/vitest-dev/vitest / startContextSpan

Method startContextSpan

packages/vitest/src/utils/traces.ts:116–138  ·  view source on GitHub ↗

* @internal

(name: string, currentContext?: Context)

Source from the content-addressed store, hash-verified

114 * @internal
115 */
116 startContextSpan(name: string, currentContext?: Context): {
117 span: Span
118 context: Context
119 } {
120 if (!this.#otel) {
121 return {
122 span: this.#noopSpan,
123 context: this.#noopContext,
124 }
125 }
126
127 const activeContext = currentContext || this.#otel.context.active()
128 const span = this.#otel.tracer.startSpan(
129 name,
130 {},
131 activeContext,
132 )
133 const context = this.#otel.trace.setSpan(activeContext, span)
134 return {
135 span,
136 context,
137 }
138 }
139
140 /**
141 * @internal

Callers 5

createTestersMethod · 0.80
tester.tsFile · 0.80
constructorMethod · 0.80
constructorMethod · 0.80
startTracesSpanMethod · 0.80

Calls 2

startSpanMethod · 0.80
activeMethod · 0.45

Tested by

no test coverage detected