summaryrefslogtreecommitdiff
path: root/shared/logger/node_modules/@sentry/core/esm/utils/hasTracingEnabled.js
blob: d71bd5afaaedf01b345b30d6f42c9c2475031d04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { getCurrentHub } from '../hub.js';

// Treeshakable guard to remove all code related to tracing

/**
 * Determines if tracing is currently enabled.
 *
 * Tracing is enabled when at least one of `tracesSampleRate` and `tracesSampler` is defined in the SDK config.
 */
function hasTracingEnabled(
  maybeOptions,
) {
  if (typeof __SENTRY_TRACING__ === 'boolean' && !__SENTRY_TRACING__) {
    return false;
  }

  const client = getCurrentHub().getClient();
  const options = maybeOptions || (client && client.getOptions());
  return !!options && (options.enableTracing || 'tracesSampleRate' in options || 'tracesSampler' in options);
}

export { hasTracingEnabled };
//# sourceMappingURL=hasTracingEnabled.js.map