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

Function withActiveSpan

packages/core/src/tracing/trace.ts:261–271  ·  view source on GitHub ↗
(span: Span | null, callback: (scope: Scope) => T)

Source from the content-addressed store, hash-verified

259 * @returns the value returned from the provided callback function.
260 */
261export function withActiveSpan<T>(span: Span | null, callback: (scope: Scope) => T): T {
262 const acs = getAcs();
263 if (acs.withActiveSpan) {
264 return acs.withActiveSpan(span, callback);
265 }
266
267 return withScope(scope => {
268 _setSpanForScope(scope, span || undefined);
269 return callback(scope);
270 });
271}
272
273/** Suppress tracing in the given callback, ensuring no spans are generated inside of it. */
274export function suppressTracing<T>(callback: () => T): T {

Callers 15

shouldComponentUpdateMethod · 0.90
componentWillUnmountMethod · 0.90
startRequestSpanHookFunction · 0.90
traceData.test.tsFile · 0.90
trace.test.tsFile · 0.90
wrapTransportOnMessageFunction · 0.90
layerHandlePatchedFunction · 0.90
api.test.tsFile · 0.90
_getPatchHandlerMethod · 0.90

Calls 4

withScopeFunction · 0.90
_setSpanForScopeFunction · 0.90
getAcsFunction · 0.85
callbackFunction · 0.50

Tested by

no test coverage detected