Skip to content

Commit ce381ac

Browse files
committed
chore(publish): Publish spotlightBrowserIntegration in dedicated integration CDN bundle
1 parent b720e15 commit ce381ac

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

packages/core/src/utils/hasTracingEnabled.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,39 @@ import type { Options } from '../types-hoist';
55
declare const __SENTRY_TRACING__: boolean | undefined;
66

77
/**
8-
* Determines if tracing is currently enabled.
8+
* Determines if span recording is currently enabled.
99
*
10-
* Tracing is enabled when at least one of `tracesSampleRate` and `tracesSampler` is defined in the SDK config.
10+
* Spans are recorded when at least one of `tracesSampleRate` and `tracesSampler`
11+
* is defined in the SDK config. This function does not make any assumption about
12+
* sampling decisions, it only checks if the SDK is configured to record spans.
13+
*
14+
* Important: This function only determines if span recording is enabled. Trace
15+
* continuation and propagation is separately controlled and not covered by this function.
16+
* If this function returns `false`, traces can still be propagated (which is what
17+
* we refer to by "Tracing without Performance")
18+
* @see https://develop.sentry.dev/sdk/telemetry/traces/tracing-without-performance/
19+
*
20+
* @param maybeOptions An SDK options object to be passed to this function.
21+
* If this option is not provided, the function will use the current client's options.
1122
*/
12-
export function hasTracingEnabled(
23+
export function hasSpansEnabled(
1324
maybeOptions?: Pick<Options, 'tracesSampleRate' | 'tracesSampler'> | undefined,
1425
): boolean {
1526
if (typeof __SENTRY_TRACING__ === 'boolean' && !__SENTRY_TRACING__) {
1627
return false;
1728
}
1829

19-
const client = getClient();
20-
const options = maybeOptions || client?.getOptions();
30+
const options = maybeOptions || getClient()?.getOptions();
2131
return (
2232
!!options &&
2333
// 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)
2434
(options.tracesSampleRate != null || !!options.tracesSampler)
2535
);
2636
}
37+
38+
/**
39+
* @see JSDoc of hasSpansEnabled()
40+
* @deprecated Use `hasSpansEnabled` instead, which is a more accurately named version of this function
41+
*/
42+
// TODO(v10): Remove this export
43+
export const hasTracingEnabled = hasSpansEnabled;

0 commit comments

Comments
 (0)