@sentry/core
Version:
Base implementation for all Sentry JavaScript SDKs
39 lines (35 loc) • 1.4 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const carrier = require('../carrier.js');
const spanOnScope = require('../utils/spanOnScope.js');
const stackStrategy = require('./stackStrategy.js');
function setAsyncContextStrategy(strategy) {
const registry = carrier.getMainCarrier();
const sentry = carrier.getSentryCarrier(registry);
sentry.acs = strategy;
}
function getAsyncContextStrategy(carrier$1) {
const sentry = carrier.getSentryCarrier(carrier$1);
if (sentry.acs) {
return sentry.acs;
}
return stackStrategy.getStackAsyncContextStrategy();
}
function getTracingChannelBinding() {
return getAsyncContextStrategy(carrier.getMainCarrier()).getTracingChannelBinding?.();
}
function _INTERNAL_createTracingChannelBinding(asyncLocalStorage, getScopes) {
return {
asyncLocalStorage,
getStoreWithActiveSpan: (span) => {
const { scope, isolationScope } = getScopes();
const activeScope = scope.clone();
spanOnScope._setSpanForScope(activeScope, span);
return { scope: activeScope, isolationScope };
}
};
}
exports._INTERNAL_createTracingChannelBinding = _INTERNAL_createTracingChannelBinding;
exports.getAsyncContextStrategy = getAsyncContextStrategy;
exports.getTracingChannelBinding = getTracingChannelBinding;
exports.setAsyncContextStrategy = setAsyncContextStrategy;
//# sourceMappingURL=index.js.map