Files
discord-decomp/sources/by-id/module-07410-SentrySpan.js
T
2026-07-28 01:06:53 +03:00

443 lines
24 KiB
JavaScript

/* Metro module 7410; source: unknown; dependencies: [77, 6, 7, 7379, 7383, 7384, 7374, 7407, 7375, 7385, 7411, 7397, 7369, 7396, 7412, 7398, 7405] */
import * as ClassCallCheckModule from './module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import * as CreateClassModule from './module-00007-CreateClass.js'; /* Metro dependency 7 */
import * as Module00077Module from './module-00077.js'; /* Metro dependency 77 */
import * as Module07369Module from './module-07369.js'; /* Metro dependency 7369 */
import * as Module07374Module from './module-07374.js'; /* Metro dependency 7374 */
import * as Module07375Module from './module-07375.js'; /* Metro dependency 7375 */
import * as SEMANTIC_ATTRIBUTE_Module from './module-07384-SEMANTIC_ATTRIBUTE_.js'; /* Metro dependency 7384 */
import * as DEBUG_BUILDModule from './module-07397-DEBUG_BUILD.js'; /* Metro dependency 7397 */
import * as moduleValue4 from './module-07411.js'; /* Metro dependency 7411 */
function _fun59702(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#59702, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:6, offset: 0x016f01bf, size: 148 bytes, params: 8, frame: 17
const env0_0 = require;
const isSpanTimeInput_59703 = function(a0) {
var r0;
var value = a0;
r0 = value && typeof value === 'number';
r0 = !r0 ? value instanceof global.Date : r0;
if (!r0) {
value = global.Array.isArray(value);
r0 = value;
}
return r0;
};
const isFullFinishedSpan_59704 = function(a0) {
return !!(a0.start_timestamp && a0.timestamp && a0.span_id && a0.trace_id);
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
exports.SentrySpan = _fun59706();
function isStandaloneSpan_59705(a0) { // fn#59705, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:6091, offset: 0x016f0253, size: 29 bytes, params: 2, frame: 10
return a0 instanceof env0_5 && a0.isStandaloneSpan();
}
function _fun59706() { // fn#59706, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:120, offset: 0x016f0270, size: 406 bytes, params: 1, frame: 15
return CreateClassModule(SentrySpan_59707, [{key: 'addLink', value: function(a0) {
return this;
}}, {key: 'addLinks', value: function(a0) {
return this;
}}, {key: 'recordException', value: function(a0, a1) {
}}, {key: 'spanContext', value: value_59711}, {key: 'setAttribute', value: function(a0, a1) {
if (a1 === undefined) {
delete this._attributes[a0];
} else {
this._attributes[a0] = a1;
}
return this;
}}, {key: 'setAttributes', value: function(a0) {
var env0_0 = a0;
var env0_1 = this;
var Object = global.Object;
Object.keys(a0).forEach(_fun59714);
return this;
}}, {key: 'updateStartTime', value: value_59715}, {key: 'setStatus', value: function(a0) {
this._status = a0;
return this;
}}, {key: 'updateName', value: function(a0) {
this._name = a0;
var SEMANTIC_ATTRIBUTE_SENTRY_SOURCE = require(dependencyMap[5]).SEMANTIC_ATTRIBUTE_SENTRY_SOURCE;
this.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'custom');
return this;
}}, {key: 'end', value: value_59718}, {key: 'getSpanJSON', value: value_59719}, {key: 'isRecording',
value: function() {
return !this._endTime && !!this._sampled;
}}, {key: 'addEvent', value: value_59721}, {key: 'isStandaloneSpan', value: function() {
return !!this._isStandaloneSpan;
}}, {key: '_onSpanEnded', value: value_59723}, {key: '_convertSpanToTransaction', value: value_59724}]);
function SentrySpan_59707() { // fn#59707, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:154, offset: 0x016f0406, size: 420 bytes, params: 1, frame: 23
const r1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
let value = environment.__proto__;
let binding = env1_3;
binding(this, SentrySpan_59707);
this._traceId = r1.traceId || (require(7379) /* metro dependency 7379 */).generateTraceId();
this._spanId = r1.spanId || (require(7379) /* metro dependency 7379 */).generateSpanId();
this._startTime = r1.startTimestamp || (require(7383) /* metro dependency 7383 */).timestampInSeconds();
this._attributes = {};
const setAttributes = this.setAttributes;
const Object = global.Object;
const assign = Object.assign;
binding = env1_2;
const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = (SEMANTIC_ATTRIBUTE_Module).SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN;
value = binding({}, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'manual');
const SEMANTIC_ATTRIBUTE_SENTRY_OP = (SEMANTIC_ATTRIBUTE_Module).SEMANTIC_ATTRIBUTE_SENTRY_OP;
value = binding(value, SEMANTIC_ATTRIBUTE_SENTRY_OP, r1.op);
Reflect.apply(setAttributes, this, [Reflect.apply(assign, Object, [value, r1.attributes])]);
this._name = r1.name;
if (r1.parentSpanId) {
this._parentSpanId = r1.parentSpanId;
}
if ('sampled' in r1) {
this._sampled = r1.sampled;
}
if (r1.endTimestamp) {
this._endTime = r1.endTimestamp;
}
this._events = [];
this._isStandaloneSpan = r1.isStandalone;
if (this._endTime) {
this._onSpanEnded();
}
}
function value_59711() { // fn#59711, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:1039, offset: 0x016f05aa, size: 82 bytes, params: 1, frame: 13
const object = {};
object.spanId = this._spanId;
object.traceId = this._traceId;
const _sampled = this._sampled;
let value = environment.__proto__;
value = require(7374) /* metro dependency 7374 */;
object.traceFlags = _sampled ? value.TRACE_FLAG_SAMPLED : value.TRACE_FLAG_NONE;
return object;
}
function value_59713(a0) { // fn#59713, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:1344, offset: 0x016f05fc, size: 51 bytes, params: 2, frame: 13
const env0_0 = a0;
const Object = global.Object;
Object.keys(a0).forEach(_fun59714);
return this;
function _fun59714(a0) { // fn#59714, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:1412, offset: 0x00d6398a, size: 32 bytes, params: 2, frame: 13
return env0_1.setAttribute(a0, env0_0[a0]);
}
}
function value_59715(a0) { // fn#59715, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:1493, offset: 0x016f062f, size: 50 bytes, params: 2, frame: 12
let value = environment.__proto__;
value = require(7374) /* metro dependency 7374 */;
value = value.spanTimeInputToSeconds(a0);
this._startTime = value;
}
function value_59718(a0) { // fn#59718, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:1807, offset: 0x016f069e, size: 94 bytes, params: 2, frame: 15
var value;
if (!this._endTime) {
value = environment.__proto__;
value = require(7374) /* metro dependency 7374 */;
this._endTime = value.spanTimeInputToSeconds(a0);
value = require(7407) /* metro dependency 7407 */;
value.logSpanEnd(this);
this._onSpanEnded();
}
}
function value_59719() { // fn#59719, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:1960, offset: 0x016f06fc, size: 446 bytes, params: 1, frame: 21
var r3;
var spanId;
var moduleValue5;
let value = environment.__proto__;
const value2 = undefined;
const dropUndefinedKeys = Module07375Module.dropUndefinedKeys;
const object = {};
let _attributes = this._attributes;
object.data = _attributes;
object.description = this._name;
_attributes = this._attributes;
const SEMANTIC_ATTRIBUTE_SENTRY_OP = (SEMANTIC_ATTRIBUTE_Module).SEMANTIC_ATTRIBUTE_SENTRY_OP;
object.op = _attributes[SEMANTIC_ATTRIBUTE_SENTRY_OP];
object.parent_span_id = this._parentSpanId;
object.span_id = this._spanId;
object.start_timestamp = this._startTime;
object.status = (require(7374) /* metro dependency 7374 */).getStatusMessage(this._status);
object.timestamp = this._endTime;
object.trace_id = this._traceId;
_attributes = this._attributes;
const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = (SEMANTIC_ATTRIBUTE_Module).SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN;
object.origin = _attributes[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN];
object._metrics_summary = (require(7385) /* metro dependency 7385 */).getMetricSummaryJsonForSpan(this);
_attributes = this._attributes;
const SEMANTIC_ATTRIBUTE_PROFILE_ID = (SEMANTIC_ATTRIBUTE_Module).SEMANTIC_ATTRIBUTE_PROFILE_ID;
object.profile_id = _attributes[SEMANTIC_ATTRIBUTE_PROFILE_ID];
_attributes = this._attributes;
const SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME = (SEMANTIC_ATTRIBUTE_Module).SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME;
object.exclusive_time = _attributes[SEMANTIC_ATTRIBUTE_EXCLUSIVE_TIME];
object.measurements = moduleValue4.timedEventsToMeasurements(this._events);
const _isStandaloneSpan = this._isStandaloneSpan;
if (_isStandaloneSpan) {
moduleValue5 = require(7374) /* metro dependency 7374 */;
r3 = moduleValue5.getRootSpan(this) === this;
} else {
r3 = _isStandaloneSpan;
}
r3 = !r3 ? value2 : r3;
object.is_segment = r3;
if (this._isStandaloneSpan) {
value = require(7374) /* metro dependency 7374 */;
value = value.getRootSpan(this);
spanId = value.spanContext().spanId;
} else {
spanId = value2;
}
object.segment_id = spanId;
return Reflect.apply(dropUndefinedKeys, Module07375Module, [object]);
}
function value_59721(a0, a1, a2) { // fn#59721, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:2907, offset: 0x016f08ba, size: 227 bytes, params: 4, frame: 19
const value = a1;
const value2 = a2;
if ((require(7397) /* metro dependency 7397 */).DEBUG_BUILD) {
(require(7369) /* metro dependency 7369 */).logger.log('[Tracing] Adding an event to span:', a0);
}
const r5 = isSpanTimeInput_59703(value) ? value : value2 || (require(7383) /* metro dependency 7383 */).timestampInSeconds();
const r1 = isSpanTimeInput_59703(value) ? {} : value || ({});
const object = {name: a0};
object.time = (require(7374) /* metro dependency 7374 */).spanTimeInputToSeconds(r5);
object.attributes = r1;
this._events.push(object);
return this;
}
function value_59723() { // fn#59723, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:3318, offset: 0x016f099d, size: 435 bytes, params: 1, frame: 18
var r3;
var moduleValue2;
var value3;
var moduleValue3;
var scope;
const DEBUG_BUILD = (DEBUG_BUILDModule).DEBUG_BUILD;
const logger = (Module07369Module).logger;
var client;
var property;
let value = environment.__proto__;
const client2 = (require(7396) /* metro dependency 7396 */).getClient();
if (client2) {
client2.emit('spanEnd', this);
}
if (this._isStandaloneSpan) {
if (this._isStandaloneSpan) {
if (this._sampled) {
value = require(7412) /* metro dependency 7412 */;
value = value.createSpanEnvelope([this], client2);
client = (require(7396) /* metro dependency 7396 */).getClient();
if (client) {
property = value[1];
if (property) {
if (property.length === 0) {
client.recordDroppedEvent('before_send', 'span');
} else {
client.sendEnvelope(value);
}
} else {
client.recordDroppedEvent('before_send', 'span');
}
}
} else {
if (DEBUG_BUILD) {
logger.log('[Tracing] Discarding standalone span because its trace was not chosen to be sampled.');
}
if (client2) {
client2.recordDroppedEvent('sample_rate', 'span');
}
}
} else {
value3 = this._convertSpanToTransaction();
if (value3) {
moduleValue3 = require(7398) /* metro dependency 7398 */;
scope = moduleValue3.getCapturedScopesOnSpan(this).scope;
if (scope) {
r3 = scope;
} else {
value = require(7396) /* metro dependency 7396 */;
value = value.getCurrentScope();
r3 = value;
}
r3.captureEvent(value3);
}
}
} else {
moduleValue2 = require(7374) /* metro dependency 7374 */;
if (this === moduleValue2.getRootSpan(this)) {
if (this._isStandaloneSpan) {
if (this._sampled) {
value = require(7412) /* metro dependency 7412 */;
value = value.createSpanEnvelope([this], client2);
client = (require(7396) /* metro dependency 7396 */).getClient();
if (client) {
property = value[1];
if (property) {
if (property.length === 0) {
client.recordDroppedEvent('before_send', 'span');
} else {
client.sendEnvelope(value);
}
} else {
client.recordDroppedEvent('before_send', 'span');
}
}
} else {
if (DEBUG_BUILD) {
logger.log('[Tracing] Discarding standalone span because its trace was not chosen to be sampled.');
}
if (client2) {
client2.recordDroppedEvent('sample_rate', 'span');
}
}
} else {
value3 = this._convertSpanToTransaction();
if (value3) {
moduleValue3 = require(7398) /* metro dependency 7398 */;
scope = moduleValue3.getCapturedScopesOnSpan(this).scope;
if (scope) {
r3 = scope;
} else {
value = require(7396) /* metro dependency 7396 */;
value = value.getCurrentScope();
r3 = value;
}
r3.captureEvent(value3);
}
}
}
}
}
function value_59724() { // fn#59724, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:4068, offset: 0x016f0b50, size: 991 bytes, params: 1, frame: 29
var environment;
var r4;
var _name;
const DEBUG_BUILD = (DEBUG_BUILDModule).DEBUG_BUILD;
const logger = (Module07369Module).logger;
var capturedScopesOnSpan;
var scope;
var isolationScope;
var value8;
var value9;
var _attributes;
var property;
var Object;
var assign;
var object;
var object2;
var Object2;
var assign2;
var object3;
var moduleValue7;
var dropUndefinedKeys;
var object4;
var value12;
var moduleValue10;
var value13;
const value = environment.__proto__;
const isFullFinishedSpan_59704Binding = isFullFinishedSpan_59704;
const moduleValue = require(7374) /* metro dependency 7374 */;
if (isFullFinishedSpan_59704Binding(moduleValue.spanToJSON(this))) {
_name = this._name;
if (!_name) {
if (DEBUG_BUILD) {
logger.warn('Transaction has no name, falling back to `<unlabeled transaction>`.');
}
this._name = '<unlabeled transaction>';
}
capturedScopesOnSpan = (require(7398) /* metro dependency 7398 */).getCapturedScopesOnSpan(this);
scope = capturedScopesOnSpan.scope;
isolationScope = capturedScopesOnSpan.isolationScope;
r4 = (scope || (require(7396) /* metro dependency 7396 */).getCurrentScope()).getClient() || (require(7396) /* metro dependency 7396 */).getClient();
if (this._sampled !== true) {
if (DEBUG_BUILD) {
logger.log('[Tracing] Discarding transaction because its trace was not chosen to be sampled.');
}
if (r4) {
r4.recordDroppedEvent('sample_rate', 'transaction');
}
return undefined;
}
value8 = moduleValue.getSpanDescendants(this).filter(_fun59725).map(_fun59726);
value9 = value8.filter(isFullFinishedSpan_59704);
_attributes = this._attributes;
property = _attributes[(require(7384) /* metro dependency 7384 */).SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
_attributes = this._attributes;
delete _attributes[(require(7384) /* metro dependency 7384 */).SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME];
value9.forEach(_fun59727);
Object = global.Object;
assign = Object.assign;
object = {};
object2 = {};
object2.trace = (require(7374) /* metro dependency 7374 */).spanToTransactionTraceContext(this);
object.contexts = object2;
object.spans = value9.length > 1000 ? value9.sort(function({start_timestamp}, a1) {
return start_timestamp - a1.start_timestamp;
}).slice(0, 1000) : value9;
object.start_timestamp = this._startTime;
object.timestamp = this._endTime;
_name = this._name;
object.transaction = _name;
object.type = 'transaction';
Object2 = global.Object;
assign2 = Object2.assign;
object3 = {capturedSpanScope: scope, capturedSpanIsolationScope: isolationScope};
moduleValue7 = require(7375) /* metro dependency 7375 */;
dropUndefinedKeys = moduleValue7.dropUndefinedKeys;
object4 = {};
object4.dynamicSamplingContext = (require(7405) /* metro dependency 7405 */).getDynamicSamplingContextFromSpan(this);
object.sdkProcessingMetadata = Reflect.apply(assign2, Object2, [object3, Reflect.apply(dropUndefinedKeys,
moduleValue7, [object4])]);
object._metrics_summary = (require(7385) /* metro dependency 7385 */).getMetricSummaryJsonForSpan(this);
value12 = Reflect.apply(assign, Object, [object, property && ({transaction_info: {source: property}})]);
moduleValue10 = require(7411) /* metro dependency 7411 */;
value13 = moduleValue10.timedEventsToMeasurements(this._events);
if (value13 && global.Object.keys(value13).length) {
if (DEBUG_BUILD) {
logger.log('[Measurements] Adding measurements to transaction event', global.JSON.stringify(value13,
undefined,
2));
}
value12.measurements = value13;
}
return value12;
}
function _fun59725(a0) { // fn#59725, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:4733, offset: 0x016f0f2f, size: 36 bytes, params: 2, frame: 12
var r0;
let value = a0 !== env0_0;
if (value) {
value = environment.__proto__.__proto__;
value = !isStandaloneSpan_59705(a0);
r0 = value;
} else {
r0 = value;
}
return r0;
}
function _fun59726(a0) { // fn#59726, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:4788, offset: 0x016f0f53, size: 41 bytes, params: 2, frame: 11
const value = environment.__proto__.__proto__;
return (Module07374Module).spanToJSON(a0);
}
function _fun59727(a0) { // fn#59727, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7588:5007, offset: 0x016f0f7c, size: 55 bytes, params: 2, frame: 12
var value;
let data = a0.data;
if (data) {
data = a0.data;
value = environment.__proto__.__proto__;
delete data[(require(7384) /* metro dependency 7384 */).SEMANTIC_ATTRIBUTE_SENTRY_CUSTOM_SPAN_NAME];
}
}
}
}
}
global.__d(_fun59702, 7410, [77, 6, 7, 7379, 7383, 7384, 7374, 7407, 7375, 7385, 7411, 7397, 7369, 7396, 7412, 7398,
7405]) /* metro module 7410, dependencies: [77, 6, 7, 7379, 7383, 7384, 7374, 7407, 7375, 7385, 7411, 7397, 7369, 7396, 7412, 7398, 7405] */;