UNPKG

@sentry/core

Version:
75 lines (74 loc) • 1.82 kB
import { addNonEnumerableProperty } from "../utils/object.js"; import { generateSpanId, generateTraceId } from "../utils/propagationContext.js"; import "../utils/spanUtils.js"; // src/tracing/sentryNonRecordingSpan.ts const NON_RECORDING_SPAN_FIELD = Symbol.for("sentry.nonRecordingSpan"); /** * A Sentry Span that is non-recording, meaning it will not be sent to Sentry. */ var SentryNonRecordingSpan = class { constructor(spanContext = {}) { this._traceId = spanContext.traceId || generateTraceId(); this._spanId = spanContext.spanId || generateSpanId(); this.dropReason = spanContext.dropReason; addNonEnumerableProperty(this, NON_RECORDING_SPAN_FIELD, true); } /** @inheritdoc */ spanContext() { return { spanId: this._spanId, traceId: this._traceId, traceFlags: 0 }; } /** @inheritdoc */ end(_timestamp) {} /** @inheritdoc */ setAttribute(_key, _value) { return this; } /** @inheritdoc */ setAttributes(_values) { return this; } /** @inheritdoc */ setStatus(_status) { return this; } /** @inheritdoc */ updateName(_name) { return this; } /** @inheritdoc */ isRecording() { return false; } /** @inheritdoc */ addEvent(_name, _attributesOrStartTime, _startTime) { return this; } /** @inheritDoc */ addLink(_link) { return this; } /** @inheritDoc */ addLinks(_links) { return this; } /** * This should generally not be used, * but we need it for being compliant with the OTEL Span interface. * * @hidden * @internal */ recordException(_exception, _time) {} }; /** * Whether the given span is a {@link SentryNonRecordingSpan}. */ function spanIsNonRecordingSpan(span) { return !!span && span[NON_RECORDING_SPAN_FIELD] === true; } export { SentryNonRecordingSpan, spanIsNonRecordingSpan }; //# sourceMappingURL=sentryNonRecordingSpan.js.map