decord/source/7446_getTraceData.js

72 lines
2.5 KiB
JavaScript
Raw Normal View History

2026-08-06 08:05:19 +00:00
// Module ID: 7446
// Function ID: 7447
2026-07-29 08:29:29 +00:00
// Name: getTraceData
2026-08-06 08:05:19 +00:00
// Dependencies: [7371, 7374, 7403, 7389, 7402, 7423, 7393, 7394, 7380, 7411, 7388, 7387, 7375]
2026-07-29 08:29:29 +00:00
// Exports: getTraceData
2026-08-06 08:05:19 +00:00
// Module 7446 (getTraceData)
2026-07-29 08:29:29 +00:00
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 = {};
}
2026-08-06 08:05:19 +00:00
const client = require(7402) /* getClient */.getClient();
const obj2 = require(7402) /* getClient */;
2026-07-29 08:29:29 +00:00
if (obj3.isEnabled()) {
if (client) {
2026-08-06 08:05:19 +00:00
let tmpResult = tmp(7393);
2026-07-29 08:29:29 +00:00
const mainCarrier = tmpResult.getMainCarrier();
2026-08-06 08:05:19 +00:00
tmpResult = tmp(7394);
2026-07-29 08:29:29 +00:00
const asyncContextStrategy = tmpResult.getAsyncContextStrategy(mainCarrier);
if (asyncContextStrategy.getTraceData) {
return asyncContextStrategy.getTraceData(obj);
} else {
2026-08-06 08:05:19 +00:00
const currentScope = tmp(7402).getCurrentScope();
2026-07-29 08:29:29 +00:00
let span = obj.span;
if (!span) {
2026-08-06 08:05:19 +00:00
span = tmp(7380).getActiveSpan();
const tmpResult2 = tmp(7380);
2026-07-29 08:29:29 +00:00
}
if (span) {
2026-08-06 08:05:19 +00:00
let spanToTraceHeaderResult = tmp(7380).spanToTraceHeader(span);
const tmpResult3 = tmp(7380);
2026-07-29 08:29:29 +00:00
} else {
const propagationContext = currentScope.getPropagationContext();
({ traceId, sampled, spanId } = propagationContext);
2026-08-06 08:05:19 +00:00
spanToTraceHeaderResult = tmp(7387).generateSentryTraceHeader(traceId, spanId, sampled);
const tmpResult4 = tmp(7387);
2026-07-29 08:29:29 +00:00
}
2026-08-06 08:05:19 +00:00
const tmpResult5 = tmp(7411);
2026-07-29 08:29:29 +00:00
if (span) {
let dynamicSamplingContextFromSpan = tmpResult5.getDynamicSamplingContextFromSpan(span);
} else {
dynamicSamplingContextFromSpan = tmpResult5.getDynamicSamplingContextFromScope(client, currentScope);
}
2026-08-06 08:05:19 +00:00
const tmpResult1 = tmp(7402);
const result = tmp(7388).dynamicSamplingContextToSentryBaggageHeader(dynamicSamplingContextFromSpan);
const TRACEPARENT_REGEXP = tmp(7387).TRACEPARENT_REGEXP;
2026-07-29 08:29:29 +00:00
if (TRACEPARENT_REGEXP.test(spanToTraceHeaderResult)) {
obj = { "sentry-trace": null, baggage: null };
obj[0] = spanToTraceHeaderResult;
obj[1] = result;
} else {
2026-08-06 08:05:19 +00:00
const logger = tmp(7375).logger;
2026-07-29 08:29:29 +00:00
logger.warn("Invalid sentry-trace data. Cannot generate trace data");
obj = {};
}
return obj;
}
}
}
return {};
};