UNPKG

796 BJavaScriptView Raw
1Object.defineProperty(exports, '__esModule', { value: true });
2
3const hub = require('../hub.js');
4
5// Treeshakable guard to remove all code related to tracing
6
7/**
8 * Determines if tracing is currently enabled.
9 *
10 * Tracing is enabled when at least one of `tracesSampleRate` and `tracesSampler` is defined in the SDK config.
11 */
12function hasTracingEnabled(
13 maybeOptions,
14) {
15 if (typeof __SENTRY_TRACING__ === 'boolean' && !__SENTRY_TRACING__) {
16 return false;
17 }
18
19 const client = hub.getCurrentHub().getClient();
20 const options = maybeOptions || (client && client.getOptions());
21 return !!options && (options.enableTracing || 'tracesSampleRate' in options || 'tracesSampler' in options);
22}
23
24exports.hasTracingEnabled = hasTracingEnabled;
25//# sourceMappingURL=hasTracingEnabled.js.map