-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(browser)!: Extract performance.{mark,measure} spans into new userTimingSpansIntegration
#22554
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c376629
feat(browser)!: Extract `performance.{mark,measure}` spans into new `…
msonnb b8e4a21
fix tests
msonnb ea4df09
rename integration and sentry.origin, move tests
msonnb 88d45ad
use new `beforeIdleSpanEnd` hook instead of performance observer
msonnb 3b6cc68
migrate tests to span streaming
msonnb df7f7ce
remove sentry-tracing-init mark
msonnb 1fddf59
remove non-recording guard
msonnb 62cd1ff
sentry.origin
msonnb 0b4721e
remove from bundles
msonnb 8f7fa80
make usertiming a pluggable integration
msonnb 101614c
fix tests
msonnb e93a464
move tests
msonnb 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 hidden or 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
47 changes: 0 additions & 47 deletions
47
...ser-integration-tests/suites/tracing/browserTracingIntegration/ignoreMeasureSpans/test.ts
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
dev-packages/browser-integration-tests/suites/tracing/user-timing/disabled/init.js
This file contains hidden or 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,12 @@ | ||
| import * as Sentry from '@sentry/browser'; | ||
|
|
||
| window.Sentry = Sentry; | ||
|
|
||
| Sentry.init({ | ||
| dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
| integrations: [Sentry.browserTracingIntegration()], | ||
| tracesSampleRate: 1, | ||
| }); | ||
|
|
||
| performance.mark('app-ready'); | ||
| performance.measure('app-initialization'); |
18 changes: 18 additions & 0 deletions
18
dev-packages/browser-integration-tests/suites/tracing/user-timing/disabled/test.ts
This file contains hidden or 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,18 @@ | ||
| import { expect } from '@playwright/test'; | ||
| import { sentryTest } from '../../../../utils/fixtures'; | ||
| import { shouldSkipTracingTest } from '../../../../utils/helpers'; | ||
| import { getSpanOp, waitForStreamedSpans } from '../../../../utils/spanUtils'; | ||
|
|
||
| sentryTest('does not capture mark and measure spans by default', async ({ getLocalTestUrl, page }) => { | ||
| sentryTest.skip(shouldSkipTracingTest()); | ||
|
|
||
| const url = await getLocalTestUrl({ testDir: __dirname }); | ||
| const spansPromise = waitForStreamedSpans(page, spans => spans.some(span => getSpanOp(span) === 'pageload')); | ||
|
|
||
| await page.goto(url); | ||
|
|
||
| const spans = await spansPromise; | ||
| const userTimingSpans = spans.filter(span => ['mark', 'measure'].includes(getSpanOp(span) ?? '')); | ||
|
|
||
| expect(userTimingSpans).toHaveLength(0); | ||
| }); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
8 changes: 2 additions & 6 deletions
8
...ingIntegration/ignoreMeasureSpans/init.js → .../suites/tracing/user-timing/spans/init.js
This file contains hidden or 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
28 changes: 28 additions & 0 deletions
28
dev-packages/browser-integration-tests/suites/tracing/user-timing/spans/test.ts
This file contains hidden or 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,28 @@ | ||
| import { expect } from '@playwright/test'; | ||
| import { sentryTest } from '../../../../utils/fixtures'; | ||
| import { shouldSkipTracingTest } from '../../../../utils/helpers'; | ||
| import { getSpanOp, waitForStreamedSpans } from '../../../../utils/spanUtils'; | ||
|
|
||
| sentryTest('captures non-ignored mark and measure spans', async ({ getLocalTestUrl, page }) => { | ||
| sentryTest.skip(shouldSkipTracingTest()); | ||
|
|
||
| const url = await getLocalTestUrl({ testDir: __dirname }); | ||
| const spansPromise = waitForStreamedSpans(page, spans => spans.some(span => getSpanOp(span) === 'pageload')); | ||
|
|
||
| await page.goto(url); | ||
|
|
||
| const spans = await spansPromise; | ||
| const userTimingSpans = spans | ||
| .filter(span => ['mark', 'measure'].includes(getSpanOp(span) ?? '')) | ||
| .map(span => ({ | ||
| name: span.name, | ||
| op: getSpanOp(span), | ||
| origin: span.attributes['sentry.origin']?.value, | ||
| })) | ||
| .sort((a, b) => a.name.localeCompare(b.name)); | ||
|
|
||
| expect(userTimingSpans).toEqual([ | ||
| { name: 'mark-pass', op: 'mark', origin: 'auto.browser.user_timing.mark' }, | ||
| { name: 'measure-pass', op: 'measure', origin: 'auto.browser.user_timing.measure' }, | ||
| ]); | ||
| }); |
This file contains hidden or 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 hidden or 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.
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.
suggestion: wdyt about pulling all the usertiming tests out of the
/metricssub directory? Given this is now an integration, it could just live undertracing.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.
+1 I think the browser metrics is a bloated term right now