* Updates the root span and isolation scope with the parameterized route name.
(request: Request, method: string, route: string)
| 57 | * Updates the root span and isolation scope with the parameterized route name. |
| 58 | */ |
| 59 | function updateRouteTransactionName(request: Request, method: string, route: string): void { |
| 60 | const transactionName = `${method} ${route}`; |
| 61 | |
| 62 | // Try the stored root span first (reliable across async contexts), |
| 63 | // then fall back to getActiveSpan() for cases where async context is preserved. |
| 64 | const rootSpan = rootSpanForRequest.get(request); |
| 65 | if (rootSpan) { |
| 66 | updateSpanName(rootSpan, transactionName); |
| 67 | rootSpan.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); |
| 68 | } else { |
| 69 | const activeSpan = getActiveSpan(); |
| 70 | if (activeSpan) { |
| 71 | const root = getRootSpan(activeSpan); |
| 72 | updateSpanName(root, transactionName); |
| 73 | root.setAttribute(SEMANTIC_ATTRIBUTE_SENTRY_SOURCE, 'route'); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | getIsolationScope().setTransactionName(transactionName); |
| 78 | } |
| 79 | |
| 80 | function defaultShouldHandleError(context: ErrorContext): boolean { |
| 81 | const status = context.set.status; |
no test coverage detected