MCPcopy Index your code
hub / github.com/getsentry/sentry-javascript / withActiveSpan

Function withActiveSpan

packages/opentelemetry/src/trace.ts:186–189  ·  view source on GitHub ↗
(span: Span | null, callback: (scope: Scope) => T)

Source from the content-addressed store, hash-verified

184 * @returns the value returned from the provided callback function.
185 */
186export function withActiveSpan<T>(span: Span | null, callback: (scope: Scope) => T): T {
187 const newContextWithActiveSpan = span ? trace.setSpan(context.active(), span) : trace.deleteSpan(context.active());
188 return context.with(newContextWithActiveSpan, () => callback(getCurrentScope()));
189}
190
191function getTracer(): Tracer {
192 const client = getClient<Client & OpenTelemetryClient>();

Callers 2

getActiveSpanWrapperFunction · 0.70

Calls 4

getCurrentScopeFunction · 0.90
callbackFunction · 0.50
activeMethod · 0.45
withMethod · 0.45

Tested by

no test coverage detected