UNPKG

@sentry/nextjs

Version:
32 lines (28 loc) 1.38 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const core = require('@sentry/core'); const attributes = require('@sentry/conventions/attributes'); const urls = require('./urls.js'); function setUrlProcessingMetadata(event) { if (event.type !== "transaction" || event.contexts?.trace?.op !== "http.server" || !event.contexts?.trace?.data) { return; } const client = core.getClient(); if (!client) { return; } const traceData = event.contexts.trace.data; const componentRoute = traceData["next.route"] || traceData["http.route"]; const httpTarget = traceData["http.target"] || traceData[attributes.URL_PATH]; if (!componentRoute) { return; } const isolationScopeData = event.sdkProcessingMetadata?.capturedSpanIsolationScope?.getScopeData(); const headersDict = isolationScopeData?.sdkProcessingMetadata?.normalizedRequest?.headers; const url = urls.getSanitizedRequestUrl(componentRoute, void 0, headersDict, httpTarget?.toString()); if (url && isolationScopeData?.sdkProcessingMetadata) { isolationScopeData.sdkProcessingMetadata.normalizedRequest = isolationScopeData.sdkProcessingMetadata.normalizedRequest || {}; isolationScopeData.sdkProcessingMetadata.normalizedRequest.url = url; } } exports.setUrlProcessingMetadata = setUrlProcessingMetadata; //# sourceMappingURL=setUrlProcessingMetadata.js.map