Files
discord-decomp/_bundle/Module6407.js
T
2026-11-01 12:12:55 +02:00

42 lines
1.6 KiB
JavaScript

// Metro module 6407 (f6408).
import { hasTracingEnabled } from "./Module6400";
import { getIsolationScope } from "./Module6395";
import { parseSampleRate } from "./Module6408";
import { DEBUG_BUILD } from "./Module6396";
import { logger } from "./consoleSandbox_6368";
export function sampleSpan(a0, a1) {
let r50, r69;
if (hasTracingEnabled(a0)) {
const normalizedRequest = getIsolationScope().getScopeData().sdkProcessingMetadata.normalizedRequest;
const r26 = {
...a1,
normalizedRequest: a1.normalizedRequest || normalizedRequest
};
const r31 = typeof a0.tracesSampler === "function" ? a0.tracesSampler(r26) : r26.parentSampled !== void 0 ? r26.parentSampled : a0.tracesSampleRate !== void 0 ? a0.tracesSampleRate : 1;
const r36 = parseSampleRate(r31);
if (r36 === void 0) {
if (DEBUG_BUILD) {
logger.warn("[Tracing] Discarding transaction because of invalid sample rate.");
}
r50 = [false];
} else if (r36) {
if (Math.random() < r36) {
r69 = [true, r36];
} else {
if (DEBUG_BUILD) {
logger.log(`[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = ${Number(r31)})`);
}
r69 = [false, r36];
}
r50 = r69;
} else {
if (DEBUG_BUILD) {
logger.log("[Tracing] Discarding transaction because " + (typeof a0.tracesSampler === "function" ? "tracesSampler returned 0 or false" : "a negative sampling decision was inherited or tracesSampleRate is set to 0"));
}
r50 = [false, r36];
}
return r50;
}
return [false];
}