-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix(nextjs): Filter out empty base server spans #19268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,232 @@ | ||||||
| import type { Event } from '@sentry/core'; | ||||||
| import { getGlobalScope, GLOBAL_OBJ } from '@sentry/core'; | ||||||
| import * as SentryNode from '@sentry/node'; | ||||||
| import { afterEach, describe, expect, it, vi } from 'vitest'; | ||||||
| import { isEmptyBaseServerTrace } from '../../src/common/utils/tracingUtils'; | ||||||
| import { init } from '../../src/server'; | ||||||
|
|
||||||
| // normally this is set as part of the build process, so mock it here | ||||||
| (GLOBAL_OBJ as typeof GLOBAL_OBJ & { _sentryRewriteFramesDistDir: string })._sentryRewriteFramesDistDir = '.next'; | ||||||
|
|
||||||
| describe('NextLowQualityTransactionsFilter', () => { | ||||||
| afterEach(() => { | ||||||
| vi.clearAllMocks(); | ||||||
|
|
||||||
| SentryNode.getGlobalScope().clear(); | ||||||
| SentryNode.getIsolationScope().clear(); | ||||||
| SentryNode.getCurrentScope().clear(); | ||||||
| SentryNode.getCurrentScope().setClient(undefined); | ||||||
| }); | ||||||
|
Comment on lines
+12
to
+19
|
||||||
|
|
||||||
| function getEventProcessor(): (event: Event) => Event | null { | ||||||
| init({}); | ||||||
|
|
||||||
| const eventProcessors = getGlobalScope()['_eventProcessors']; | ||||||
|
||||||
| const eventProcessors = getGlobalScope()['_eventProcessors']; | |
| const eventProcessors = getGlobalScope().getScopeData().eventProcessors; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warning message hard-codes
BaseServer.handleRequest, butdropNextjsRootContext()is a generic helper used from pages-router instrumentation and may be called in other tracing contexts. Consider rewording to a more general message (e.g. "Next.js root transaction may not be dropped") to avoid misleading debug output.