71 lines
2.5 KiB
JavaScript
71 lines
2.5 KiB
JavaScript
// Module ID: 7465
|
|
// Function ID: 7466
|
|
// Name: getTraceData
|
|
// Dependencies: [7390, 7393, 7422, 7408, 7421, 7442, 7412, 7413, 7399, 7430, 7407, 7406, 7394]
|
|
// Exports: getTraceData
|
|
|
|
// Module 7465 (getTraceData)
|
|
import "errorCallback";
|
|
import __SENTRY_DEBUG__ from "__SENTRY_DEBUG__";
|
|
import __SENTRY_DEBUG__ from "__SENTRY_DEBUG__";
|
|
import dateTimestampInSeconds from "dateTimestampInSeconds";
|
|
|
|
|
|
export const getTraceData = function getTraceData() {
|
|
let sampled;
|
|
let spanId;
|
|
let traceId;
|
|
let obj = arg0;
|
|
if (arg0 === undefined) {
|
|
obj = {};
|
|
}
|
|
const client = require(7421) /* getClient */.getClient();
|
|
const obj2 = require(7421) /* getClient */;
|
|
if (obj3.isEnabled()) {
|
|
if (client) {
|
|
let tmpResult = tmp(7412);
|
|
const mainCarrier = tmpResult.getMainCarrier();
|
|
tmpResult = tmp(7413);
|
|
const asyncContextStrategy = tmpResult.getAsyncContextStrategy(mainCarrier);
|
|
if (asyncContextStrategy.getTraceData) {
|
|
return asyncContextStrategy.getTraceData(obj);
|
|
} else {
|
|
const currentScope = tmp(7421).getCurrentScope();
|
|
let span = obj.span;
|
|
if (!span) {
|
|
span = tmp(7399).getActiveSpan();
|
|
const tmpResult2 = tmp(7399);
|
|
}
|
|
if (span) {
|
|
let spanToTraceHeaderResult = tmp(7399).spanToTraceHeader(span);
|
|
const tmpResult3 = tmp(7399);
|
|
} else {
|
|
const propagationContext = currentScope.getPropagationContext();
|
|
({ traceId, sampled, spanId } = propagationContext);
|
|
spanToTraceHeaderResult = tmp(7406).generateSentryTraceHeader(traceId, spanId, sampled);
|
|
const tmpResult4 = tmp(7406);
|
|
}
|
|
const tmpResult5 = tmp(7430);
|
|
if (span) {
|
|
let dynamicSamplingContextFromSpan = tmpResult5.getDynamicSamplingContextFromSpan(span);
|
|
} else {
|
|
dynamicSamplingContextFromSpan = tmpResult5.getDynamicSamplingContextFromScope(client, currentScope);
|
|
}
|
|
const tmpResult1 = tmp(7421);
|
|
const result = tmp(7407).dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContextFromSpan);
|
|
const TRACEPARENT_REGEXP = tmp(7406).TRACEPARENT_REGEXP;
|
|
if (TRACEPARENT_REGEXP.test(spanToTraceHeaderResult)) {
|
|
obj = { "sentry-trace": null, baggage: null };
|
|
obj[0] = spanToTraceHeaderResult;
|
|
obj[1] = result;
|
|
} else {
|
|
const logger = tmp(7394).logger;
|
|
logger.warn("Invalid sentry-trace data. Cannot generate trace data");
|
|
obj = {};
|
|
}
|
|
return obj;
|
|
}
|
|
}
|
|
}
|
|
return {};
|
|
};
|