UNPKG

@sentry/nextjs

Version:
26 lines (22 loc) 889 B
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const core = require('@sentry/core'); const nextSpanAttributes = require('./nextSpanAttributes.js'); function enhanceMiddlewareRootSpan(span) { const { attributes } = span; if (attributes[nextSpanAttributes.ATTR_NEXT_SPAN_TYPE] !== "Middleware.execute") { return; } span.setOp("http.server.middleware"); const spanName = attributes[nextSpanAttributes.ATTR_NEXT_SPAN_NAME]; if (typeof spanName !== "string" || !spanName || !span.getName()) { return; } const match = spanName.match(/^middleware (GET|POST|PUT|DELETE|PATCH|HEAD|OPTIONS)/); if (match) { span.setName(`middleware ${match[1]}`); } else { span.setName(core.stripUrlQueryAndFragment(spanName)); } } exports.enhanceMiddlewareRootSpan = enhanceMiddlewareRootSpan; //# sourceMappingURL=enhanceMiddlewareRootSpan.js.map