-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
feat(core): Ensure startSpan()
can handle spans that require parent
#10386
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
3 commits
Select commit
Hold shift + click to select a range
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
10 changes: 10 additions & 0 deletions
10
...ckages/browser-integration-tests/suites/tracing/request/fetch-with-no-active-span/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,10 @@ | ||
import * as Sentry from '@sentry/browser'; | ||
|
||
window.Sentry = Sentry; | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/1337', | ||
// disable pageload transaction | ||
integrations: [Sentry.BrowserTracing({ tracingOrigins: ['http://example.com'], startTransactionOnPageLoad: false })], | ||
tracesSampleRate: 1, | ||
}); |
1 change: 1 addition & 0 deletions
1
...ges/browser-integration-tests/suites/tracing/request/fetch-with-no-active-span/subject.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 @@ | ||
fetch('http://example.com/0').then(fetch('http://example.com/1').then(fetch('http://example.com/2'))); |
35 changes: 35 additions & 0 deletions
35
...ckages/browser-integration-tests/suites/tracing/request/fetch-with-no-active-span/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,35 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { envelopeUrlRegex, shouldSkipTracingTest } from '../../../../utils/helpers'; | ||
|
||
sentryTest( | ||
'there should be no span created for fetch requests with no active span', | ||
async ({ getLocalTestPath, page }) => { | ||
if (shouldSkipTracingTest()) { | ||
sentryTest.skip(); | ||
} | ||
|
||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
|
||
let requestCount = 0; | ||
page.on('request', request => { | ||
expect(envelopeUrlRegex.test(request.url())).toBe(false); | ||
requestCount++; | ||
}); | ||
|
||
await page.goto(url); | ||
|
||
// Here are the requests that should exist: | ||
// 1. HTML page | ||
// 2. Init JS bundle | ||
// 3. Subject JS bundle | ||
// 4 [OPTIONAl] CDN JS bundle | ||
// and then 3 fetch requests | ||
if (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle_')) { | ||
expect(requestCount).toBe(7); | ||
} else { | ||
expect(requestCount).toBe(6); | ||
} | ||
}, | ||
); |
10 changes: 10 additions & 0 deletions
10
...packages/browser-integration-tests/suites/tracing/request/xhr-with-no-active-span/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,10 @@ | ||
import * as Sentry from '@sentry/browser'; | ||
|
||
window.Sentry = Sentry; | ||
|
||
Sentry.init({ | ||
dsn: 'https://[email protected]/1337', | ||
// disable pageload transaction | ||
integrations: [Sentry.BrowserTracing({ tracingOrigins: ['http://example.com'], startTransactionOnPageLoad: false })], | ||
tracesSampleRate: 1, | ||
}); |
11 changes: 11 additions & 0 deletions
11
...kages/browser-integration-tests/suites/tracing/request/xhr-with-no-active-span/subject.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,11 @@ | ||
const xhr_1 = new XMLHttpRequest(); | ||
xhr_1.open('GET', 'http://example.com/0'); | ||
xhr_1.send(); | ||
|
||
const xhr_2 = new XMLHttpRequest(); | ||
xhr_2.open('GET', 'http://example.com/1'); | ||
xhr_2.send(); | ||
|
||
const xhr_3 = new XMLHttpRequest(); | ||
xhr_3.open('GET', 'http://example.com/2'); | ||
xhr_3.send(); |
35 changes: 35 additions & 0 deletions
35
...packages/browser-integration-tests/suites/tracing/request/xhr-with-no-active-span/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,35 @@ | ||
import { expect } from '@playwright/test'; | ||
|
||
import { sentryTest } from '../../../../utils/fixtures'; | ||
import { envelopeUrlRegex, shouldSkipTracingTest } from '../../../../utils/helpers'; | ||
|
||
sentryTest( | ||
'there should be no span created for xhr requests with no active span', | ||
async ({ getLocalTestPath, page }) => { | ||
if (shouldSkipTracingTest()) { | ||
sentryTest.skip(); | ||
} | ||
|
||
const url = await getLocalTestPath({ testDir: __dirname }); | ||
|
||
let requestCount = 0; | ||
page.on('request', request => { | ||
expect(envelopeUrlRegex.test(request.url())).toBe(false); | ||
requestCount++; | ||
}); | ||
|
||
await page.goto(url); | ||
|
||
// Here are the requests that should exist: | ||
// 1. HTML page | ||
// 2. Init JS bundle | ||
// 3. Subject JS bundle | ||
// 4 [OPTIONAl] CDN JS bundle | ||
// and then 3 fetch requests | ||
if (process.env.PW_BUNDLE && process.env.PW_BUNDLE.startsWith('bundle_')) { | ||
expect(requestCount).toBe(7); | ||
} else { | ||
expect(requestCount).toBe(6); | ||
} | ||
}, | ||
); |
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
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.
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.
Check failure
Code scanning / CodeQL
Missing regular expression anchor