Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
412 lines
13 KiB
JavaScript
412 lines
13 KiB
JavaScript
// Module ID: 725
|
|
// Function ID: 726
|
|
// Dependencies: [41, 42, 694, 703, 704, 684, 726, 727, 688, 689, 713, 728, 685, 722]
|
|
|
|
// Module 725
|
|
import _classCallCheck from "_classCallCheck" /* 41 */;
|
|
import _createClass from "_createClass" /* 42 */;
|
|
|
|
const SentrySpan = require;
|
|
function isFullFinishedSpan(start_timestamp) {
|
|
return start_timestamp.start_timestamp && start_timestamp.timestamp && start_timestamp.span_id && start_timestamp.trace_id;
|
|
}
|
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
class SentrySpan {
|
|
constructor() {
|
|
obj = global;
|
|
if (global === undefined) {
|
|
obj = {};
|
|
}
|
|
self = this;
|
|
tmp = c2(this, SentrySpan);
|
|
traceId = obj.traceId;
|
|
if (!traceId) {
|
|
tmp2 = closure_0;
|
|
tmp3 = closure_1;
|
|
obj2 = closure_0(closure_1[2]);
|
|
traceId = obj2.generateTraceId();
|
|
}
|
|
self._traceId = traceId;
|
|
spanId = obj.spanId;
|
|
if (!spanId) {
|
|
tmp4 = closure_0;
|
|
tmp5 = closure_1;
|
|
obj3 = closure_0(closure_1[2]);
|
|
spanId = obj3.generateSpanId();
|
|
}
|
|
self._spanId = spanId;
|
|
startTimestamp = obj.startTimestamp;
|
|
if (!startTimestamp) {
|
|
tmp6 = closure_0;
|
|
tmp7 = closure_1;
|
|
obj4 = closure_0(closure_1[3]);
|
|
startTimestamp = obj4.timestampInSeconds();
|
|
}
|
|
self._startTime = startTimestamp;
|
|
self._links = obj.links;
|
|
self._attributes = {};
|
|
obj1 = { [closure_2_0(closure_2_1[4]).SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: "manual" };
|
|
obj1[closure_0(closure_1[4]).SEMANTIC_ATTRIBUTE_SENTRY_OP] = obj.op;
|
|
merged = Object.assign(obj.attributes);
|
|
setAttributesResult = self.setAttributes(obj1);
|
|
self._name = obj.name;
|
|
if (obj.parentSpanId) {
|
|
self._parentSpanId = obj.parentSpanId;
|
|
}
|
|
if ("sampled" in obj) {
|
|
self._sampled = obj.sampled;
|
|
}
|
|
if (obj.endTimestamp) {
|
|
self._endTime = obj.endTimestamp;
|
|
}
|
|
self._events = [];
|
|
self._isStandaloneSpan = obj.isStandalone;
|
|
if (self._endTime) {
|
|
_onSpanEndedResult = self._onSpanEnded();
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
const entry = {
|
|
key: "addLink",
|
|
value: function addLink(arg0) {
|
|
const self = this;
|
|
if (this._links) {
|
|
const _links = self._links;
|
|
_links.push(arg0);
|
|
} else {
|
|
const items = [arg0];
|
|
self._links = items;
|
|
}
|
|
return self;
|
|
}
|
|
};
|
|
let items = [
|
|
entry,
|
|
{
|
|
key: "addLinks",
|
|
value: function addLinks(_links) {
|
|
const self = this;
|
|
if (this._links) {
|
|
_links = self._links;
|
|
const push = _links.push;
|
|
const items = [];
|
|
HermesBuiltin.arraySpread(_links, 0);
|
|
HermesBuiltin.apply(items, _links);
|
|
} else {
|
|
self._links = _links;
|
|
}
|
|
return self;
|
|
}
|
|
},
|
|
{
|
|
key: "recordException",
|
|
value: function recordException(arg0, arg1) {
|
|
|
|
}
|
|
},
|
|
{
|
|
key: "spanContext",
|
|
value: function spanContext() {
|
|
const obj = { spanId: this._spanId, traceId: this._traceId, traceFlags: null };
|
|
const tmp = SentrySpan(684);
|
|
obj.traceFlags = this._sampled ? tmp.TRACE_FLAG_SAMPLED : tmp.TRACE_FLAG_NONE;
|
|
return obj;
|
|
}
|
|
},
|
|
{
|
|
key: "setAttribute",
|
|
value: function setAttribute(arg0, arg1) {
|
|
const self = this;
|
|
if (undefined === arg1) {
|
|
const _attributes = self._attributes;
|
|
delete tmp[tmp2];
|
|
} else {
|
|
self._attributes[arg0] = arg1;
|
|
}
|
|
return self;
|
|
}
|
|
},
|
|
{
|
|
key: "setAttributes",
|
|
value: function setAttributes(arg0) {
|
|
const self = this;
|
|
closure_0 = arg0;
|
|
const keys = Object.keys(arg0);
|
|
const item = keys.forEach((item) => self.setAttribute(item, closure_0[item]));
|
|
return this;
|
|
}
|
|
},
|
|
{
|
|
key: "updateStartTime",
|
|
value: function updateStartTime(arg0) {
|
|
this._startTime = SentrySpan(684).spanTimeInputToSeconds(arg0);
|
|
}
|
|
},
|
|
{
|
|
key: "setStatus",
|
|
value: function setStatus(_status) {
|
|
this._status = _status;
|
|
return this;
|
|
}
|
|
},
|
|
{
|
|
key: "updateName",
|
|
value: function updateName(_name) {
|
|
this._name = _name;
|
|
const attr = this.setAttribute(SentrySpan(704).SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, "custom");
|
|
return this;
|
|
}
|
|
},
|
|
{
|
|
key: "end",
|
|
value: function end(arg0) {
|
|
const self = this;
|
|
if (!this._endTime) {
|
|
self._endTime = SentrySpan(684).spanTimeInputToSeconds(arg0);
|
|
const obj = SentrySpan(684);
|
|
SentrySpan(726).logSpanEnd(self);
|
|
self._onSpanEnded();
|
|
const obj2 = SentrySpan(726);
|
|
}
|
|
}
|
|
},
|
|
{
|
|
key: "getSpanJSON",
|
|
value: function getSpanJSON() {
|
|
const self = this;
|
|
const obj = { data: this._attributes, description: this._name, op: this._attributes[SentrySpan(undefined, 704).SEMANTIC_ATTRIBUTE_SENTRY_OP], parent_span_id: this._parentSpanId, span_id: this._spanId, start_timestamp: this._startTime, status: SentrySpan(684).getStatusMessage(this._status), timestamp: null, trace_id: null, origin: _attributes[SentrySpan(undefined, 704).SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN], profile_id: this._attributes[SentrySpan(undefined, 704).SEMANTIC_ATTRIBUTE_PROFILE_ID], exclusive_time: this._attributes[SentrySpan(undefined, 704).SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME], measurements: null, is_segment: null, segment_id: null, links: null };
|
|
({ _endTime: obj.timestamp, _traceId: obj.trace_id, _attributes } = this);
|
|
const obj2 = SentrySpan(684);
|
|
obj.measurements = SentrySpan(727).timedEventsToMeasurements(this._events);
|
|
let _isStandaloneSpan = this._isStandaloneSpan;
|
|
if (_isStandaloneSpan) {
|
|
_isStandaloneSpan = tmp(684).getRootSpan(self) === self;
|
|
const tmpResult = tmp(684);
|
|
}
|
|
obj.is_segment = _isStandaloneSpan;
|
|
let spanId;
|
|
if (self._isStandaloneSpan) {
|
|
const rootSpan = tmp(684).getRootSpan(self);
|
|
spanId = rootSpan.spanContext().spanId;
|
|
const tmpResult3 = tmp(684);
|
|
}
|
|
obj.segment_id = spanId;
|
|
const obj3 = SentrySpan(727);
|
|
obj.links = SentrySpan(684).convertSpanLinksForEnvelope(self._links);
|
|
return obj;
|
|
}
|
|
},
|
|
{
|
|
key: "isRecording",
|
|
value: function isRecording() {
|
|
const _endTime = this._endTime;
|
|
let _sampled = !_endTime;
|
|
if (!_endTime) {
|
|
_sampled = this._sampled;
|
|
}
|
|
return _sampled;
|
|
}
|
|
},
|
|
{
|
|
key: "addEvent",
|
|
value: function addEvent(name, num, arg2) {
|
|
if (SentrySpan(688).DEBUG_BUILD) {
|
|
const debug = tmp(689).debug;
|
|
debug.log("[Tracing] Adding an event to span:", name);
|
|
}
|
|
let isArray = num;
|
|
if (num) {
|
|
isArray = typeof num === "number";
|
|
}
|
|
if (!isArray) {
|
|
const _Date = Date;
|
|
isArray = num instanceof Date;
|
|
}
|
|
if (!isArray) {
|
|
const _Array = Array;
|
|
isArray = Array.isArray(num);
|
|
}
|
|
let tmp7 = num;
|
|
if (!isArray) {
|
|
let timestampInSecondsResult = arg2;
|
|
if (!arg2) {
|
|
timestampInSecondsResult = tmp(703).timestampInSeconds();
|
|
const tmpResult = tmp(703);
|
|
}
|
|
tmp7 = timestampInSecondsResult;
|
|
}
|
|
let isArray1 = num;
|
|
if (num) {
|
|
isArray1 = typeof num === "number";
|
|
}
|
|
if (!isArray1) {
|
|
const _Date2 = Date;
|
|
isArray1 = num instanceof Date;
|
|
}
|
|
if (!isArray1) {
|
|
const _Array2 = Array;
|
|
isArray1 = Array.isArray(num);
|
|
}
|
|
if (isArray1) {
|
|
let obj = {};
|
|
} else {
|
|
obj = num;
|
|
if (!num) {
|
|
obj = {};
|
|
}
|
|
}
|
|
const obj2 = { name, time: SentrySpan(684).spanTimeInputToSeconds(tmp7), attributes: obj };
|
|
const _events = this._events;
|
|
_events.push(obj2);
|
|
return this;
|
|
}
|
|
},
|
|
{
|
|
key: "isStandaloneSpan",
|
|
value: function isStandaloneSpan() {
|
|
return this._isStandaloneSpan;
|
|
}
|
|
},
|
|
{
|
|
key: "_onSpanEnded",
|
|
value: function _onSpanEnded() {
|
|
const self = this;
|
|
const client = SentrySpan(713).getClient();
|
|
if (client) {
|
|
client.emit("spanEnd", self);
|
|
}
|
|
if (self._isStandaloneSpan) {
|
|
if (self._isStandaloneSpan) {
|
|
if (self._sampled) {
|
|
const items = [self];
|
|
const spanEnvelope = tmp(728).createSpanEnvelope(items, client);
|
|
const tmpResult = tmp(728);
|
|
const client1 = tmp(713).getClient();
|
|
if (client1) {
|
|
if (spanEnvelope[1]) {
|
|
if (0 !== arr2.length) {
|
|
client1.sendEnvelope(spanEnvelope);
|
|
}
|
|
}
|
|
client1.recordDroppedEvent("before_send", "span");
|
|
}
|
|
const tmpResult5 = tmp(713);
|
|
} else {
|
|
if (tmp(688).DEBUG_BUILD) {
|
|
const debug = tmp(689).debug;
|
|
debug.log("[Tracing] Discarding standalone span because its trace was not chosen to be sampled.");
|
|
}
|
|
if (client) {
|
|
client.recordDroppedEvent("sample_rate", "span");
|
|
}
|
|
}
|
|
} else {
|
|
const result = self._convertSpanToTransaction();
|
|
if (result) {
|
|
let scope = tmp(685).getCapturedScopesOnSpan(self).scope;
|
|
if (!scope) {
|
|
scope = tmp(713).getCurrentScope();
|
|
const tmpResult7 = tmp(713);
|
|
}
|
|
scope.captureEvent(result);
|
|
const tmpResult6 = tmp(685);
|
|
}
|
|
}
|
|
} else {
|
|
const tmpResult8 = tmp(684);
|
|
}
|
|
}
|
|
},
|
|
{
|
|
key: "_convertSpanToTransaction",
|
|
value: function _convertSpanToTransaction() {
|
|
const self = this;
|
|
const spanToJSONResult = self(684).spanToJSON(this);
|
|
if (tmp6) {
|
|
if (!self._name) {
|
|
if (tmp3(688).DEBUG_BUILD) {
|
|
const debug = tmp3(689).debug;
|
|
debug.warn("Transaction has no name, falling back to `<unlabeled transaction>`.");
|
|
}
|
|
self._name = "<unlabeled transaction>";
|
|
}
|
|
const capturedScopesOnSpan = tmp3(685).getCapturedScopesOnSpan(self);
|
|
const scope = capturedScopesOnSpan.scope;
|
|
if (scope != null) {
|
|
const sdkProcessingMetadata = scope.getScopeData().sdkProcessingMetadata;
|
|
if (sdkProcessingMetadata != null) {
|
|
const normalizedRequest = sdkProcessingMetadata.normalizedRequest;
|
|
}
|
|
}
|
|
if (true === self._sampled) {
|
|
const spanDescendants = tmp3(684).getSpanDescendants(self);
|
|
const found = spanDescendants.filter((isStandaloneSpan) => {
|
|
let tmp = isStandaloneSpan !== self;
|
|
if (tmp) {
|
|
tmp = !(isStandaloneSpan instanceof _moduleResult && isStandaloneSpan.isStandaloneSpan());
|
|
const tmp3 = isStandaloneSpan instanceof _moduleResult && isStandaloneSpan.isStandaloneSpan();
|
|
}
|
|
return tmp;
|
|
});
|
|
const mapped = found.map((item) => self(684).spanToJSON(item));
|
|
const found1 = mapped.filter(isFullFinishedSpan);
|
|
const tmp11 = self._attributes[tmp3(undefined, 704).SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
|
|
const _attributes = self._attributes;
|
|
let SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME = tmp3(704).SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME;
|
|
delete tmp2[tmp];
|
|
const item = found1.forEach((item) => {
|
|
const SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME = self(704).SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME;
|
|
delete tmp2[tmp];
|
|
});
|
|
const obj2 = { contexts: null, spans: null, start_timestamp: null, timestamp: null, transaction: null, type: "transaction", sdkProcessingMetadata: null, request: null };
|
|
const obj3 = { trace: null };
|
|
const tmp3Result5 = tmp3(684);
|
|
obj3.trace = tmp3(684).spanToTransactionTraceContext(self);
|
|
obj2.contexts = obj3;
|
|
let substr = found1;
|
|
if (found1.length > 1000) {
|
|
const sorted = found1.sort((start_timestamp, start_timestamp2) => start_timestamp.start_timestamp - start_timestamp2.start_timestamp);
|
|
substr = sorted.slice(0, 1000);
|
|
}
|
|
obj2.spans = substr;
|
|
({ _startTime: obj4.start_timestamp, _endTime: obj4.timestamp, _name: obj4.transaction } = self);
|
|
const obj5 = { capturedSpanScope: scope, capturedSpanIsolationScope: capturedScopesOnSpan.isolationScope, dynamicSamplingContext: null };
|
|
const tmp3Result6 = tmp3(684);
|
|
obj5.dynamicSamplingContext = tmp3(722).getDynamicSamplingContextFromSpan(self);
|
|
obj2.sdkProcessingMetadata = obj5;
|
|
obj2.request = normalizedRequest;
|
|
let tmp14 = tmp11;
|
|
if (tmp11) {
|
|
const obj6 = { transaction_info: null };
|
|
const obj7 = { source: tmp11 };
|
|
obj6.transaction_info = obj7;
|
|
tmp14 = obj6;
|
|
}
|
|
const merged = Object.assign(tmp14);
|
|
const tmp3Result7 = tmp3(722);
|
|
const result = tmp3(727).timedEventsToMeasurements(self._events);
|
|
let length = result;
|
|
if (result) {
|
|
const _Object = Object;
|
|
length = Object.keys(result).length;
|
|
}
|
|
if (length) {
|
|
if (tmp3(688).DEBUG_BUILD) {
|
|
const debug2 = tmp3(689).debug;
|
|
const _JSON = JSON;
|
|
debug2.log("[Measurements] Adding measurements to transaction event", JSON.stringify(result, undefined, 2));
|
|
}
|
|
obj2.measurements = result;
|
|
}
|
|
return obj2;
|
|
}
|
|
const tmp3Result = tmp3(685);
|
|
}
|
|
}
|
|
}
|
|
];
|
|
const _moduleResult = _createClass(SentrySpan, items);
|
|
let c3 = _moduleResult;
|
|
|
|
export const SentrySpan = _moduleResult;
|