( maybeOptions?: Pick<CoreOptions, 'tracesSampleRate' | 'tracesSampler'> | undefined, )
| 21 | * If this option is not provided, the function will use the current client's options. |
| 22 | */ |
| 23 | export 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 | } |
no test coverage detected