UNPKG

@sentry/nextjs

Version:
29 lines (25 loc) • 1.07 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const op = require('@sentry/conventions/op'); const attributes = require('@sentry/conventions/attributes'); const core = require('@sentry/core'); const nextSpanAttributes = require('./nextSpanAttributes.js'); function enhanceMiddlewareRootSpan(span) { const { attributes: attributes$1 } = span; if (attributes$1[nextSpanAttributes.ATTR_NEXT_SPAN_TYPE] !== "Middleware.execute") { return; } span.setOp(op.MIDDLEWARE); const spanName = attributes$1[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]}`); attributes$1[attributes.SENTRY_SEGMENT_NAME_SOURCE] = "route"; } else { span.setName(core.stripUrlQueryAndFragment(spanName)); } } exports.enhanceMiddlewareRootSpan = enhanceMiddlewareRootSpan; //# sourceMappingURL=enhanceMiddlewareRootSpan.js.map