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

Function hasSpansEnabled

packages/core/src/utils/hasSpansEnabled.ts:23–36  ·  view source on GitHub ↗
(
  maybeOptions?: Pick<CoreOptions, 'tracesSampleRate' | 'tracesSampler'> | undefined,
)

Source from the content-addressed store, hash-verified

21 * If this option is not provided, the function will use the current client's options.
22 */
23export function hasSpansEnabled(
24 maybeOptions?: Pick<CoreOptions, 'tracesSampleRate' | 'tracesSampler'> | undefined,
25): boolean {
26 if (typeof __SENTRY_TRACING__ === 'boolean' && !__SENTRY_TRACING__) {
27 return false;
28 }
29
30 const options = maybeOptions || getClient()?.getOptions();
31 return (
32 !!options &&
33 // Note: This check is `!= null`, meaning "nullish". `0` is not "nullish", `undefined` and `null` are. (This comment was brought to you by 15 minutes of questioning life)
34 (options.tracesSampleRate != null || !!options.tracesSampler)
35 );
36}

Callers 15

wrapRequestHandlerFunction · 0.90
instrumentFetchRequestFunction · 0.90
getTraceDataFunction · 0.90
wrapServerEmitRequestFunction · 0.90
sampleSpanFunction · 0.90
startIdleSpanFunction · 0.90
createChildOrRootSpanFunction · 0.90
ensureIsWrappedFunction · 0.90

Calls 2

getClientFunction · 0.90
getOptionsMethod · 0.65

Tested by

no test coverage detected