Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
83 lines
2.5 KiB
JavaScript
83 lines
2.5 KiB
JavaScript
// Module ID: 12938
|
|
// Function ID: 12939
|
|
// Dependencies: [12939, 12936]
|
|
// Exports: extractTraceparentData, generateSentryTraceHeader, propagationContextFromHeaders
|
|
|
|
// Module 12938
|
|
import generatePropagationContext from "generatePropagationContext" /* 12936 */;
|
|
import BAGGAGE_HEADER_NAME from "BAGGAGE_HEADER_NAME" /* 12939 */;
|
|
|
|
require = arg1;
|
|
const dependencyMap = arg6;
|
|
const regExp = new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");
|
|
|
|
export const TRACEPARENT_REGEXP = regExp;
|
|
export const extractTraceparentData = function extractTraceparentData(str) {
|
|
if (str) {
|
|
const match = str.match(regExp);
|
|
if (match) {
|
|
let flag = true;
|
|
if ("1" !== match[3]) {
|
|
if ("0" === match[3]) {
|
|
flag = false;
|
|
}
|
|
}
|
|
const obj = { traceId: match[1], parentSampled: flag, parentSpanId: match[2] };
|
|
return obj;
|
|
}
|
|
}
|
|
};
|
|
export const generateSentryTraceHeader = function generateSentryTraceHeader() {
|
|
let traceId = arg0;
|
|
if (arg0 === undefined) {
|
|
traceId = generatePropagationContext.generateTraceId();
|
|
}
|
|
let spanId = arg1;
|
|
if (arg1 === undefined) {
|
|
spanId = generatePropagationContext.generateSpanId();
|
|
}
|
|
let str = "";
|
|
if (undefined !== arg2) {
|
|
let str2 = "-0";
|
|
if (arg2) {
|
|
str2 = "-1";
|
|
}
|
|
str = str2;
|
|
}
|
|
return "" + traceId + "-" + spanId + str;
|
|
};
|
|
export const propagationContextFromHeaders = function propagationContextFromHeaders(str, arg1) {
|
|
let tmp;
|
|
if (str) {
|
|
const match = str.match(regExp);
|
|
if (match) {
|
|
let flag = true;
|
|
if ("1" !== match[3]) {
|
|
if ("0" === match[3]) {
|
|
flag = false;
|
|
}
|
|
}
|
|
const obj = { traceId: match[1], parentSampled: flag, parentSpanId: match[2] };
|
|
tmp = obj;
|
|
}
|
|
}
|
|
let result = BAGGAGE_HEADER_NAME.baggageHeaderToDynamicSamplingContext(arg1);
|
|
if (tmp) {
|
|
if (tmp.traceId) {
|
|
const obj3 = { traceId: null, parentSpanId: null, spanId: null, sampled: null, dsc: null };
|
|
({ traceId: obj7.traceId, parentSpanId: obj7.parentSpanId, parentSampled } = tmp);
|
|
obj3.spanId = tmp4(12936).generateSpanId();
|
|
obj3.sampled = parentSampled;
|
|
if (!result) {
|
|
result = {};
|
|
}
|
|
obj3.dsc = result;
|
|
return obj3;
|
|
}
|
|
}
|
|
const obj4 = { traceId: null, spanId: null };
|
|
obj4.traceId = generatePropagationContext.generateTraceId();
|
|
const tmp4Result3 = generatePropagationContext;
|
|
obj4.spanId = generatePropagationContext.generateSpanId();
|
|
return obj4;
|
|
};
|