@sentry/core
Version:
Base implementation for all Sentry JavaScript SDKs
31 lines (27 loc) • 1.15 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const debugBuild = require('../../debug-build.js');
const object = require('../../utils/object.js');
const safeCallback = require('../../utils/safeCallback.js');
function withStaticSpan(callback) {
object.addNonEnumerableProperty(callback, "_static", true);
return callback;
}
function withStreamedSpan(callback) {
return callback;
}
function isStaticBeforeSendSpanCallback(callback) {
return !!callback && typeof callback === "function" && "_static" in callback && !!callback._static;
}
function applyBeforeSendSpanCallback(span, beforeSendSpan) {
const modifiedSpan = safeCallback.safeCallback(
debugBuild.DEBUG_BUILD ? "The `beforeSendSpan` callback threw an error, sending the span unmodified:" : "",
() => beforeSendSpan(span),
() => span
);
return modifiedSpan || span;
}
exports.applyBeforeSendSpanCallback = applyBeforeSendSpanCallback;
exports.isStaticBeforeSendSpanCallback = isStaticBeforeSendSpanCallback;
exports.withStaticSpan = withStaticSpan;
exports.withStreamedSpan = withStreamedSpan;
//# sourceMappingURL=beforeSendSpan.js.map