decord/source/__polyfill/12xxx/module_12866.js
github-actions e510164e6b chore: update source for alpha 346.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
2026-09-10 05:38:07 +00:00

68 lines
2.4 KiB
JavaScript

// Module ID: 12866
// Function ID: 12867
// Dependencies: [12859, 12854, 12867, 12855, 12827]
// Exports: sampleSpan
// Module 12866
import _mod12859 from "module_12859" /* 12859 */;
require = arg1;
const dependencyMap = arg6;
export const sampleSpan = function sampleSpan(tracesSampler, normalizedRequest) {
if (obj.hasTracingEnabled(tracesSampler)) {
const isolationScope = tmp(12854).getIsolationScope();
const obj2 = {};
const merged = Object.assign(normalizedRequest);
obj2.normalizedRequest = normalizedRequest.normalizedRequest || isolationScope.getScopeData().sdkProcessingMetadata.normalizedRequest;
if (typeof tracesSampler.tracesSampler === "function") {
let num = tracesSampler.tracesSampler(obj2);
} else if (undefined !== obj2.parentSampled) {
num = obj2.parentSampled;
} else {
num = 1;
if (undefined !== tracesSampler.tracesSampleRate) {
num = tracesSampler.tracesSampleRate;
}
}
const tmpResult = tmp(12854);
const parseSampleRateResult = tmp(12867).parseSampleRate(num);
if (undefined === parseSampleRateResult) {
if (tmp(12855).DEBUG_BUILD) {
const logger3 = tmp(12827).logger;
logger3.warn("[Tracing] Discarding transaction because of invalid sample rate.");
}
const items = [false];
let items3 = items;
} else if (parseSampleRateResult) {
const _Math = Math;
if (Math.random() < parseSampleRateResult) {
const items1 = [true, parseSampleRateResult];
let items2 = items1;
} else {
if (tmp(12855).DEBUG_BUILD) {
const logger2 = tmp(12827).logger;
const _Number = Number;
const _HermesInternal = HermesInternal;
logger2.log("[Tracing] Discarding transaction because it's not included in the random sample (sampling rate = " + Number(num) + ")");
}
items2 = [false, parseSampleRateResult];
}
} else {
if (tmp(12855).DEBUG_BUILD) {
const logger = tmp(12827).logger;
let str = "a negative sampling decision was inherited or tracesSampleRate is set to 0";
if (typeof tracesSampler.tracesSampler === "function") {
str = "tracesSampler returned 0 or false";
}
logger.log(`[Tracing] Discarding transaction because ${str}`);
}
items3 = [false, parseSampleRateResult];
}
return items3;
} else {
const items4 = [false];
return items4;
}
obj = _mod12859;
};