Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/test-ssr',
'url.path': '/test-ssr',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-ssr$/),
}),
op: 'pageload',
origin: 'auto.pageload.astro',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ test.describe('tracing in static/pre-rendered routes', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/test-static',
'url.path': '/test-static',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-static$/),
}),
op: 'pageload',
origin: 'auto.pageload.astro',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/test-ssr',
'url.path': '/test-ssr',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-ssr$/),
}),
op: 'pageload',
origin: 'auto.pageload.astro',
Expand Down Expand Up @@ -213,6 +216,9 @@ test.describe('nested SSR routes (client, server, server request)', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/user-page/[userId]',
'url.path': '/user-page/myUsername123',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user-page\/myUsername123$/),
},
},
},
Expand Down Expand Up @@ -309,6 +315,9 @@ test.describe('nested SSR routes (client, server, server request)', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/catchAll/[...path]',
'url.path': '/catchAll/hell0/whatever-do',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/catchAll\/hell0\/whatever-do$/),
},
},
},
Expand Down Expand Up @@ -366,6 +375,9 @@ test.describe('parametrized vs static paths', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/user-page/settings',
'url.path': '/user-page/settings',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user-page\/settings$/),
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ test.describe('tracing in static routes with server islands', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/server-island',
'url.path': '/server-island',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/server-island$/),
}),
op: 'pageload',
origin: 'auto.pageload.astro',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ test.describe('tracing in static/pre-rendered routes', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/test-static',
'url.path': '/test-static',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-static$/),
}),
op: 'pageload',
origin: 'auto.pageload.astro',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ test.describe('tracing in dynamically rendered (ssr) routes', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/test-ssr',
'url.path': '/test-ssr',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-ssr$/),
}),
op: 'pageload',
origin: 'auto.pageload.astro',
Expand Down Expand Up @@ -213,6 +216,9 @@ test.describe('nested SSR routes (client, server, server request)', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/user-page/[userId]',
'url.path': '/user-page/myUsername123',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user-page\/myUsername123$/),
},
},
},
Expand Down Expand Up @@ -309,6 +315,9 @@ test.describe('nested SSR routes (client, server, server request)', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/catchAll/[...path]',
'url.path': '/catchAll/hell0/whatever-do',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/catchAll\/hell0\/whatever-do$/),
},
},
},
Expand Down Expand Up @@ -366,6 +375,9 @@ test.describe('parametrized vs static paths', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/user-page/settings',
'url.path': '/user-page/settings',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user-page\/settings$/),
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ test.describe('tracing in static routes with server islands', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/server-island',
'url.path': '/server-island',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/server-island$/),
}),
op: 'pageload',
origin: 'auto.pageload.astro',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ test.describe('tracing in static/pre-rendered routes', () => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.astro',
'sentry.source': 'route',
'url.template': '/test-static',
'url.path': '/test-static',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/test-static$/),
}),
op: 'pageload',
origin: 'auto.pageload.astro',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ test('should create a pageload transaction when the `app` directory is used', as
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'url',
'url.path': '/pageload-transaction',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/pageload-transaction$/),
// no url.template because source is url and we didn't paremeterize the route
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ test('should report a navigation transaction for pages router navigations', asyn
'sentry.op': 'navigation',
'sentry.origin': 'auto.navigation.nextjs.pages_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/foo\/navigation-target-page$/),
'url.path': '/foo/navigation-target-page',
'url.template': '/[param]/navigation-target-page',
},
op: 'navigation',
origin: 'auto.navigation.nextjs.pages_router_instrumentation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ test('should create a pageload transaction when the `pages` directory is used',
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/foo\/pages-pageload$/),
'url.path': '/foo/pages-pageload',
'url.template': '/[param]/pages-pageload',
},
op: 'pageload',
origin: 'auto.pageload.nextjs.pages_router_instrumentation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ test('should create a parameterized transaction when the `app` directory is used
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino$/),
'url.path': '/parameterized/cappuccino',
'url.template': '/parameterized/:one',
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down Expand Up @@ -61,6 +64,9 @@ test('should create a static transaction when the `app` directory is used and th
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'url',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/static$/),
'url.path': '/parameterized/static',
// no url.template because source is url and we didn't paremeterize the route
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down Expand Up @@ -100,6 +106,9 @@ test('should create a partially parameterized transaction when the `app` directo
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep$/),
'url.path': '/parameterized/cappuccino/beep',
'url.template': '/parameterized/:one/beep',
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down Expand Up @@ -140,6 +149,9 @@ test('should create a nested parameterized transaction when the `app` directory
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep\/espresso$/),
'url.path': '/parameterized/cappuccino/beep/espresso',
'url.template': '/parameterized/:one/beep/:two',
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@ test('Creates a navigation transaction for basePath router with prefix', async (
await page.waitForTimeout(1000);
await page.getByText('router.push()').click();

expect(await navigationTransactionPromise).toBeDefined();
const navigationTransaction = await navigationTransactionPromise;
expect(navigationTransaction).toBeDefined();

const attributes = navigationTransaction.contexts?.trace?.data;
expect(attributes).toMatchObject({
'sentry.op': 'navigation',
'sentry.origin': 'auto.navigation.nextjs.app_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/my-app\/navigation\/router-push$/),
'url.path': '/my-app/navigation/router-push',
'url.template': '/my-app/navigation/:param/router-push',
});
});

test('Creates a navigation transaction for basePath <Link> with prefix', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ test('should create a parameterized transaction when the `app` directory is used
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino$/),
'url.path': '/parameterized/cappuccino',
'url.template': '/parameterized/:one',
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down Expand Up @@ -61,6 +64,9 @@ test('should create a static transaction when the `app` directory is used and th
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'url',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/static$/),
'url.path': '/parameterized/static',
// no url.template because source is url and we didn't paremeterize the route
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down Expand Up @@ -100,6 +106,9 @@ test('should create a partially parameterized transaction when the `app` directo
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep$/),
'url.path': '/parameterized/cappuccino/beep',
'url.template': '/parameterized/:one/beep',
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down Expand Up @@ -140,6 +149,9 @@ test('should create a nested parameterized transaction when the `app` directory
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep\/espresso$/),
'url.path': '/parameterized/cappuccino/beep/espresso',
'url.template': '/parameterized/:one/beep/:two',
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ test('should create a parameterized transaction when the `app` directory is used
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino$/),
'url.path': '/parameterized/cappuccino',
'url.template': '/parameterized/:one',
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down Expand Up @@ -61,6 +64,9 @@ test('should create a static transaction when the `app` directory is used and th
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'url',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/static$/),
'url.path': '/parameterized/static',
// no url.template because source is url and we didn't paremeterize the route
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down Expand Up @@ -100,6 +106,9 @@ test('should create a partially parameterized transaction when the `app` directo
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep$/),
'url.path': '/parameterized/cappuccino/beep',
'url.template': '/parameterized/:one/beep',
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down Expand Up @@ -140,6 +149,9 @@ test('should create a nested parameterized transaction when the `app` directory
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/parameterized\/cappuccino\/beep\/espresso$/),
'url.path': '/parameterized/cappuccino/beep/espresso',
'url.template': '/parameterized/:one/beep/:two',
},
op: 'pageload',
origin: 'auto.pageload.nextjs.app_router_instrumentation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ test('Sends a pageload transaction', async ({ page }) => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.app_router_instrumentation',
'sentry.source': 'url',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/),
'url.path': '/',
// no url.template because the route isn't parameterized (sentry.source: 'url')
}),
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ test('Sends a pageload transaction', async ({ page }) => {
'sentry.op': 'pageload',
'sentry.origin': 'auto.pageload.nextjs.pages_router_instrumentation',
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/$/),
'url.path': '/',
'url.template': '/',
}),
},
}),
Expand Down Expand Up @@ -86,6 +89,9 @@ test('Sends a navigation transaction', async ({ page }) => {
'sentry.origin': 'auto.navigation.nextjs.pages_router_instrumentation',
'sentry.sample_rate': 1,
'sentry.source': 'route',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/user\/5$/),
'url.path': '/user/5',
'url.template': '/user/[id]',
}),
links: [
{
Expand Down
1 change: 1 addition & 0 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"dependencies": {
"@sentry/browser": "10.63.0",
"@sentry/core": "10.63.0",
"@sentry/conventions": "^0.15.1",
"@sentry/node": "10.63.0",
"@sentry/vite-plugin": "^5.3.0"
},
Expand Down
2 changes: 2 additions & 0 deletions packages/astro/src/client/browserTracingIntegration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
SEMANTIC_ATTRIBUTE_SENTRY_SOURCE,
} from '@sentry/core';
import { DEBUG_BUILD } from '../debug-build';
import { URL_TEMPLATE } from '@sentry/conventions/attributes';

/**
* Returns the value of a meta-tag
Expand Down Expand Up @@ -48,6 +49,7 @@ export function browserTracingIntegration(
attributes: {
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: source,
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.astro',
...(source === 'route' && { [URL_TEMPLATE]: name }),
},
});
}
Expand Down
Loading
Loading