-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(tanstackstart-react): Add distributed tracing #21144
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
Draft
nicohrubec
wants to merge
6
commits into
develop
Choose a base branch
from
feat/tanstack-start-distributed-tracing
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3c4a86f
feat(tanstackstart-react): Add distributed tracing via meta tag injec…
nicohrubec 73386ab
fix: Match original comment from Astro middleware
nicohrubec 618c60e
fix: Match Astro injectMetaTagsInResponse implementation 1:1
nicohrubec bfbfd8e
fix: Use inline captureException with auto.http.tanstackstart mechanism
nicohrubec 99207fb
fix: Rename bodyIterator to bodyReporter, add mechanism to outer catch
nicohrubec d276437
fix: Avoid calling controller.close() after controller.error()
nicohrubec 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
38 changes: 14 additions & 24 deletions
38
...packages/e2e-tests/test-applications/tanstackstart-react-cloudflare/src/routes/__root.tsx
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
36 changes: 36 additions & 0 deletions
36
...2e-tests/test-applications/tanstackstart-react-cloudflare/tests/trace-propagation.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,36 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
| import { waitForTransaction } from '@sentry-internal/test-utils'; | ||
|
|
||
| test.describe('Trace propagation', () => { | ||
| test('should inject metatags in ssr pageload', async ({ page }) => { | ||
| await page.goto('/'); | ||
|
|
||
| const sentryTraceContent = await page.getAttribute('meta[name="sentry-trace"]', 'content'); | ||
| expect(sentryTraceContent).toBeDefined(); | ||
| expect(sentryTraceContent).toMatch(/^[a-f0-9]{32}-[a-f0-9]{16}-[01]$/); | ||
|
|
||
| const baggageContent = await page.getAttribute('meta[name="baggage"]', 'content'); | ||
| expect(baggageContent).toBeDefined(); | ||
| expect(baggageContent).toContain('sentry-environment=qa'); | ||
| expect(baggageContent).toContain('sentry-public_key='); | ||
| expect(baggageContent).toContain('sentry-trace_id='); | ||
| expect(baggageContent).toContain('sentry-sampled='); | ||
| }); | ||
|
|
||
| test('should have trace connection between server and client', async ({ page }) => { | ||
| const serverTxPromise = waitForTransaction('tanstackstart-react-cloudflare', transactionEvent => { | ||
| return transactionEvent?.contexts?.trace?.op === 'http.server' && transactionEvent?.transaction === 'GET /'; | ||
| }); | ||
|
|
||
| const clientTxPromise = waitForTransaction('tanstackstart-react-cloudflare', transactionEvent => { | ||
| return transactionEvent?.contexts?.trace?.op === 'pageload' && transactionEvent?.transaction === '/'; | ||
| }); | ||
|
|
||
| await page.goto('/'); | ||
|
|
||
| const serverTx = await serverTxPromise; | ||
| const clientTx = await clientTxPromise; | ||
|
|
||
| expect(clientTx.contexts?.trace?.trace_id).toBe(serverTx.contexts?.trace?.trace_id); | ||
| }); | ||
| }); |
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
41 changes: 41 additions & 0 deletions
41
dev-packages/e2e-tests/test-applications/tanstackstart-react/tests/trace-propagation.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,41 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
| import { waitForTransaction } from '@sentry-internal/test-utils'; | ||
|
|
||
| const usesManagedTunnelRoute = | ||
| (process.env.E2E_TEST_TUNNEL_ROUTE_MODE ?? 'off') !== 'off' || process.env.E2E_TEST_CUSTOM_TUNNEL_ROUTE === '1'; | ||
|
|
||
| test.skip(usesManagedTunnelRoute, 'Default e2e suites run only in the proxy variant'); | ||
|
|
||
| test.describe('Trace propagation', () => { | ||
| test('should inject metatags in ssr pageload', async ({ page }) => { | ||
| await page.goto('/'); | ||
|
|
||
| const sentryTraceContent = await page.getAttribute('meta[name="sentry-trace"]', 'content'); | ||
| expect(sentryTraceContent).toBeDefined(); | ||
| expect(sentryTraceContent).toMatch(/^[a-f0-9]{32}-[a-f0-9]{16}-[01]$/); | ||
|
|
||
| const baggageContent = await page.getAttribute('meta[name="baggage"]', 'content'); | ||
| expect(baggageContent).toBeDefined(); | ||
| expect(baggageContent).toContain('sentry-environment=qa'); | ||
| expect(baggageContent).toContain('sentry-public_key='); | ||
| expect(baggageContent).toContain('sentry-trace_id='); | ||
| expect(baggageContent).toContain('sentry-sampled='); | ||
| }); | ||
|
|
||
| test('should have trace connection between server and client', async ({ page }) => { | ||
| const serverTxPromise = waitForTransaction('tanstackstart-react', transactionEvent => { | ||
| return transactionEvent?.contexts?.trace?.op === 'http.server' && transactionEvent?.transaction === 'GET /'; | ||
| }); | ||
|
|
||
| const clientTxPromise = waitForTransaction('tanstackstart-react', transactionEvent => { | ||
| return transactionEvent?.contexts?.trace?.op === 'pageload' && transactionEvent?.transaction === '/'; | ||
| }); | ||
|
|
||
| await page.goto('/'); | ||
|
|
||
| const serverTx = await serverTxPromise; | ||
| const clientTx = await clientTxPromise; | ||
|
|
||
| expect(clientTx.contexts?.trace?.trace_id).toBe(serverTx.contexts?.trace?.trace_id); | ||
| }); | ||
| }); |
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.
Uh oh!
There was an error while loading. Please reload this page.