@sentry/core
Version:
Base implementation for all Sentry JavaScript SDKs
34 lines (30 loc) • 1.43 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const object = require('../utils/object.js');
const weakRef = require('../utils/weakRef.js');
const SCOPE_ON_START_SPAN_FIELD = "_sentryScope";
const ISOLATION_SCOPE_ON_START_SPAN_FIELD = "_sentryIsolationScope";
const OTEL_SOURCE_INFERENCE_SPAN_FIELD = /* @__PURE__ */ Symbol.for("sentry.otelSourceInference");
function setCapturedScopesOnSpan(span, scope, isolationScope) {
if (span) {
object.addNonEnumerableProperty(span, ISOLATION_SCOPE_ON_START_SPAN_FIELD, weakRef.makeWeakRef(isolationScope));
object.addNonEnumerableProperty(span, SCOPE_ON_START_SPAN_FIELD, scope);
}
}
function getCapturedScopesOnSpan(span) {
const spanWithScopes = span;
return {
scope: spanWithScopes[SCOPE_ON_START_SPAN_FIELD],
isolationScope: weakRef.derefWeakRef(spanWithScopes[ISOLATION_SCOPE_ON_START_SPAN_FIELD])
};
}
function markSpanForOtelSourceInference(span) {
object.addNonEnumerableProperty(span, OTEL_SOURCE_INFERENCE_SPAN_FIELD, true);
}
function spanShouldInferOtelSource(span) {
return span[OTEL_SOURCE_INFERENCE_SPAN_FIELD] === true;
}
exports.getCapturedScopesOnSpan = getCapturedScopesOnSpan;
exports.markSpanForOtelSourceInference = markSpanForOtelSourceInference;
exports.setCapturedScopesOnSpan = setCapturedScopesOnSpan;
exports.spanShouldInferOtelSource = spanShouldInferOtelSource;
//# sourceMappingURL=utils.js.map