69 lines
2.5 KiB
JavaScript
69 lines
2.5 KiB
JavaScript
// Module ID: 7847
|
|
// Function ID: 7848
|
|
// Name: getTraceData
|
|
// Dependencies: [7772, 7775, 7804, 7790, 7803, 7824, 7794, 7795, 7781, 7812, 7789, 7788, 7776]
|
|
// Exports: getTraceData
|
|
|
|
// Module 7847 (getTraceData)
|
|
import errorCallback from "errorCallback" /* 7772 */;
|
|
import getClient from "getClient" /* 7803 */;
|
|
import __SENTRY_DEBUG__ from "__SENTRY_DEBUG__" /* 7775 */;
|
|
import dateTimestampInSeconds from "dateTimestampInSeconds" /* 7790 */;
|
|
|
|
errorCallback;
|
|
|
|
export const getTraceData = function getTraceData() {
|
|
let obj = arg0;
|
|
if (arg0 === undefined) {
|
|
obj = {};
|
|
}
|
|
const client = getClient.getClient();
|
|
const obj2 = getClient;
|
|
if (obj3.isEnabled()) {
|
|
if (client) {
|
|
let tmpResult = tmp(7794);
|
|
const mainCarrier = tmpResult.getMainCarrier();
|
|
tmpResult = tmp(7795);
|
|
const asyncContextStrategy = tmpResult.getAsyncContextStrategy(mainCarrier);
|
|
if (asyncContextStrategy.getTraceData) {
|
|
return asyncContextStrategy.getTraceData(obj);
|
|
} else {
|
|
const currentScope = tmp(7803).getCurrentScope();
|
|
let span = obj.span;
|
|
if (!span) {
|
|
span = tmp(7781).getActiveSpan();
|
|
const tmpResult2 = tmp(7781);
|
|
}
|
|
if (span) {
|
|
let spanToTraceHeaderResult = tmp(7781).spanToTraceHeader(span);
|
|
const tmpResult3 = tmp(7781);
|
|
} else {
|
|
const propagationContext = currentScope.getPropagationContext();
|
|
({ traceId, sampled, spanId } = propagationContext);
|
|
spanToTraceHeaderResult = tmp(7788).generateSentryTraceHeader(traceId, spanId, sampled);
|
|
const tmpResult4 = tmp(7788);
|
|
}
|
|
const tmpResult5 = tmp(7812);
|
|
if (span) {
|
|
let dynamicSamplingContextFromSpan = tmpResult5.getDynamicSamplingContextFromSpan(span);
|
|
} else {
|
|
dynamicSamplingContextFromSpan = tmpResult5.getDynamicSamplingContextFromScope(client, currentScope);
|
|
}
|
|
const tmpResult1 = tmp(7803);
|
|
const result = tmp(7789).dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContextFromSpan);
|
|
const TRACEPARENT_REGEXP = tmp(7788).TRACEPARENT_REGEXP;
|
|
if (TRACEPARENT_REGEXP.test(spanToTraceHeaderResult)) {
|
|
obj = { "sentry-trace": null, baggage: null };
|
|
obj[0] = spanToTraceHeaderResult;
|
|
obj[1] = result;
|
|
} else {
|
|
const logger = tmp(7776).logger;
|
|
logger.warn("Invalid sentry-trace data. Cannot generate trace data");
|
|
obj = {};
|
|
}
|
|
return obj;
|
|
}
|
|
}
|
|
}
|
|
return {};
|
|
};
|