158 lines
7.5 KiB
React
158 lines
7.5 KiB
React
/* Metro module 843; source: unknown; dependencies: [844, 838, 840, 845, 846, 833] */
|
|
function _fun9126(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#9126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:970:6, offset: 0x00d5dca0, size: 168 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const closure = extractTraceparentData;
|
|
const Object = global.Object;
|
|
const defineProperty = Object.defineProperty;
|
|
const Symbol = global.Symbol;
|
|
Reflect.apply(defineProperty, Object, [exports, Symbol.toStringTag, {value: 'Module'}]);
|
|
const RegExp = global.RegExp;
|
|
exports.TRACEPARENT_REGEXP = new RegExp('^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$');
|
|
exports.extractTraceparentData = closure;
|
|
exports.generateSentryTraceHeader = generateSentryTraceHeader;
|
|
exports.generateTraceparentHeader = generateTraceparentHeader;
|
|
exports.propagationContextFromHeaders = propagationContextFromHeaders;
|
|
exports.shouldContinueTrace = shouldContinueTrace;
|
|
}
|
|
|
|
function generateTraceparentHeader() { // fn#9129, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:970:756, offset: 0x00d5de70, size: 188 bytes, params: 1, frame: 18
|
|
const value = undefined;
|
|
return '00-' + (arguments.length > 0 && value !== arguments[0] ? arguments[0] : (require(838) /* metro dependency 838 */).generateTraceId()) + '-' + (arguments.length > 1 && value !== arguments[1] ? arguments[1] : (require(838) /* metro dependency 838 */).generateSpanId()) + '-' + ((arguments.length > 2 ? arguments[2] : value) ? '01' : '00');
|
|
}
|
|
|
|
function propagationContextFromHeaders(a0, a1) { // fn#9130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:970:1058, offset: 0x00d5df2c, size: 423 bytes, params: 3, frame: 19
|
|
var parentSampled;
|
|
var r6;
|
|
var r0;
|
|
var r2;
|
|
var moduleValue2;
|
|
var sampleRate;
|
|
var moduleValue3;
|
|
var sampleRate2;
|
|
var object2;
|
|
var value;
|
|
const extractTraceparentDataBinding = extractTraceparentData;
|
|
const value2 = undefined;
|
|
const value3 = extractTraceparentDataBinding(a0);
|
|
const value4 = (require(844) /* metro dependency 844 */).baggageHeaderToDynamicSamplingContext(a1);
|
|
if (value3 == null) {
|
|
object2 = {};
|
|
value = require(838) /* metro dependency 838 */;
|
|
object2.traceId = value.generateTraceId();
|
|
value = require(840) /* metro dependency 840 */;
|
|
object2.sampleRand = value.safeMathRandom();
|
|
} else {
|
|
if (value3.traceId) {
|
|
moduleValue2 = require(845) /* metro dependency 845 */;
|
|
sampleRate = moduleValue2.parseSampleRate(value4 == null ? value2 : value4.sample_rand);
|
|
if (value2 !== sampleRate) {
|
|
r2 = sampleRate;
|
|
} else {
|
|
moduleValue3 = require(845) /* metro dependency 845 */;
|
|
sampleRate2 = moduleValue3.parseSampleRate(value4 == null ? value2 : value4.sample_rate);
|
|
if (sampleRate2) {
|
|
parentSampled = value3 == null ? value2 : value3.parentSampled;
|
|
if (value2 !== parentSampled) {
|
|
parentSampled = value3.parentSampled;
|
|
value = require(840) /* metro dependency 840 */;
|
|
value = value.safeMathRandom();
|
|
if (parentSampled) {
|
|
value *= sampleRate2;
|
|
r6 = value;
|
|
} else {
|
|
value = sampleRate2 + value * (1 - sampleRate2);
|
|
r6 = value;
|
|
}
|
|
r0 = r6;
|
|
} else {
|
|
value = require(840) /* metro dependency 840 */;
|
|
value = value.safeMathRandom();
|
|
r0 = value;
|
|
}
|
|
} else {
|
|
value = require(840) /* metro dependency 840 */;
|
|
value = value.safeMathRandom();
|
|
r0 = value;
|
|
}
|
|
r2 = r0;
|
|
}
|
|
if (value4) {
|
|
value4.sample_rand = r2.toString();
|
|
}
|
|
parentSampled = value3.parentSampled;
|
|
return {traceId: value3.traceId, parentSpanId: value3.parentSpanId, sampled: parentSampled,
|
|
dsc: value4 || ({}),
|
|
sampleRand: r2};
|
|
}
|
|
object2 = {};
|
|
object2.traceId = (require(838) /* metro dependency 838 */).generateTraceId();
|
|
object2.sampleRand = (require(840) /* metro dependency 840 */).safeMathRandom();
|
|
}
|
|
return object2;
|
|
}
|
|
|
|
function shouldContinueTrace(a0, a1) { // fn#9131, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:970:1800, offset: 0x00d5e0d3, size: 278 bytes, params: 3, frame: 22
|
|
var strictTraceContinuation;
|
|
var r2;
|
|
var r0;
|
|
const debug = (require(833) /* metro dependency 833 */).debug;
|
|
let value = a1;
|
|
const value3 = (require(846) /* metro dependency 846 */).extractOrgIdFromClient(a0);
|
|
if (value) {
|
|
if (value3) {
|
|
if (value !== value3) {
|
|
debug.log("Won't continue trace because org IDs don't match (incoming baggage: " + value + ', SDK options: ' + value3 + ')');
|
|
value = false;
|
|
r0 = value;
|
|
} else {
|
|
strictTraceContinuation = a0.getOptions().strictTraceContinuation;
|
|
strictTraceContinuation = !!strictTraceContinuation && strictTraceContinuation;
|
|
if (strictTraceContinuation) {
|
|
r2 = value && !value3;
|
|
r2 = !r2 ? !value && value3 : r2;
|
|
r0 = !r2;
|
|
} else {
|
|
r0 = !strictTraceContinuation;
|
|
}
|
|
if (!r0) {
|
|
debug.log('Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ' + value + ', Sentry client: ' + value3 + ')');
|
|
value = false;
|
|
r0 = value;
|
|
}
|
|
}
|
|
} else {
|
|
strictTraceContinuation = a0.getOptions().strictTraceContinuation;
|
|
strictTraceContinuation = !!strictTraceContinuation && strictTraceContinuation;
|
|
if (strictTraceContinuation) {
|
|
r2 = value && !value3;
|
|
r2 = !r2 ? !value && value3 : r2;
|
|
r0 = !r2;
|
|
} else {
|
|
r0 = !strictTraceContinuation;
|
|
}
|
|
if (!r0) {
|
|
debug.log('Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ' + value + ', Sentry client: ' + value3 + ')');
|
|
value = false;
|
|
r0 = value;
|
|
}
|
|
}
|
|
} else {
|
|
strictTraceContinuation = a0.getOptions().strictTraceContinuation;
|
|
strictTraceContinuation = !!strictTraceContinuation && strictTraceContinuation;
|
|
if (strictTraceContinuation) {
|
|
r2 = value && !value3;
|
|
r2 = !r2 ? !value && value3 : r2;
|
|
r0 = !r2;
|
|
} else {
|
|
r0 = !strictTraceContinuation;
|
|
}
|
|
if (!r0) {
|
|
debug.log('Starting a new trace because strict trace continuation is enabled but one org ID is missing (incoming baggage: ' + value + ', Sentry client: ' + value3 + ')');
|
|
value = false;
|
|
r0 = value;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|