-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fix(nuxt): Detect pageload by adding flag in Vue router #13171
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b6e6634
fix(nuxt): Detect pageload by adding flag in Vue
s1gr1d e31e6c9
make vue unit tests running again
s1gr1d 1877074
fix comment
s1gr1d dce66f5
review comments
s1gr1d 1d920a1
Merge branch 'develop' into sig/vue-router-pageload
s1gr1d 8fb974b
fix vue unit tests
s1gr1d 704b0c3
Merge branch 'develop' into sig/vue-router-pageload
s1gr1d f0736c3
Merge branch 'refs/heads/develop' into sig/vue-router-pageload
s1gr1d af14d4f
change variable name in comment
s1gr1d 90ef6e1
fix tests; change to logger
s1gr1d acb3e10
Merge branch 'refs/heads/develop' into sig/vue-router-pageload
s1gr1d File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
dev-packages/e2e-tests/test-applications/nuxt-3/tests/performance.client.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { expect, test } from '@nuxt/test-utils/playwright'; | ||
import { waitForTransaction } from '@sentry-internal/test-utils'; | ||
|
||
test('sends a pageload root span with a parameterized URL', async ({ page }) => { | ||
const transactionPromise = waitForTransaction('nuxt-3', async transactionEvent => { | ||
return transactionEvent.transaction === '/test-param/:param()'; | ||
}); | ||
|
||
await page.goto(`/test-param/1234`); | ||
|
||
const rootSpan = await transactionPromise; | ||
|
||
expect(rootSpan).toMatchObject({ | ||
contexts: { | ||
trace: { | ||
data: { | ||
'sentry.source': 'route', | ||
'sentry.origin': 'auto.pageload.vue', | ||
'sentry.op': 'pageload', | ||
'params.param': '1234', | ||
}, | ||
op: 'pageload', | ||
origin: 'auto.pageload.vue', | ||
}, | ||
}, | ||
transaction: '/test-param/:param()', | ||
transaction_info: { | ||
source: 'route', | ||
}, | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import { applySdkMetadata, getGlobalScope } from '@sentry/core'; | ||
import { init as initNode } from '@sentry/node'; | ||
import type { Client, EventProcessor } from '@sentry/types'; | ||
import { logger } from '@sentry/utils'; | ||
import { DEBUG_BUILD } from '../common/debug-build'; | ||
import type { SentryNuxtOptions } from '../common/types'; | ||
|
||
/** | ||
|
@@ -26,8 +28,8 @@ export function init(options: SentryNuxtOptions): Client | undefined { | |
// todo: the buildAssetDir could be changed in the nuxt config - change this to a more generic solution | ||
if (event.transaction?.match(/^GET \/_nuxt\//)) { | ||
options.debug && | ||
// eslint-disable-next-line no-console | ||
console.log('[Sentry] NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction); | ||
DEBUG_BUILD && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🙏 good change! |
||
logger.log('NuxtLowQualityTransactionsFilter filtered transaction: ', event.transaction); | ||
return null; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Added this just as a heads-up in case someone adds new tests later on.