Skip to content

Commit

Permalink
chore(publish): Publish spotlightBrowserIntegration in dedicated in…
Browse files Browse the repository at this point in the history
…tegration CDN bundle
  • Loading branch information
Lms24 committed Feb 5, 2025
1 parent b720e15 commit ce381ac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions packages/core/src/utils/hasTracingEnabled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,39 @@ import type { Options } from '../types-hoist';
declare const __SENTRY_TRACING__: boolean | undefined;

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

const client = getClient();
const options = maybeOptions || client?.getOptions();
const options = maybeOptions || getClient()?.getOptions();
return (
!!options &&
// 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)
(options.tracesSampleRate != null || !!options.tracesSampler)
);
}

/**
* @see JSDoc of hasSpansEnabled()
* @deprecated Use `hasSpansEnabled` instead, which is a more accurately named version of this function
*/
// TODO(v10): Remove this export
export const hasTracingEnabled = hasSpansEnabled;

0 comments on commit ce381ac

Please sign in to comment.