Skip to content
Merged
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
1 change: 1 addition & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ Two consequences to be aware of when upgrading:
Affected SDKs: All SDKs.

- The `http.query` and `http.fragment` span attributes were renamed to `url.query` and `url.fragment`.
- The `url.path.params.<key>` attribute was removed from the TanStack Router (library) integration. The replacement is `url.path.parameter.<key>` and holds the same values.
- The gen_ai cache token attributes `gen_ai.usage.cache_creation_input_tokens` and `gen_ai.usage.cache_read_input_tokens` were renamed to `gen_ai.usage.cache_creation.input_tokens` and `gen_ai.usage.cache_read.input_tokens`.
- The `gen_ai.system` span attribute was renamed to `gen_ai.provider.name` across all AI integrations.
- The `gen_ai.request.available_tools` span attribute was renamed to `gen_ai.tool.definitions` across all AI integrations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ test.describe('router basepath', () => {
// match already set, so the stale `a`/`b`/`c` params survive on the span. Keys are passed as
// arrays because `toHaveProperty` would otherwise read the dots as a nested lookup.
const traceData = rootSpan.contexts?.trace?.data;
expect(traceData).not.toHaveProperty(['url.path.params.a']);
expect(traceData).not.toHaveProperty(['url.path.params.b']);
expect(traceData).not.toHaveProperty(['url.path.params.c']);
expect(traceData).toHaveProperty(['url.path.params.postId'], '456');
expect(traceData).not.toHaveProperty(['url.path.parameter.a']);
expect(traceData).not.toHaveProperty(['url.path.parameter.b']);
expect(traceData).not.toHaveProperty(['url.path.parameter.c']);
expect(traceData).toHaveProperty(['url.path.parameter.postId'], '456');
expect(traceData).toHaveProperty(['url.template'], '/posts/$postId');
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) =
'sentry.source': 'route',
'sentry.origin': 'auto.pageload.react.tanstack_router',
'sentry.op': 'pageload',
'url.path.params.postId': '456',
'url.path.parameter.postId': '456',
'url.template': '/posts/$postId',
'url.path': '/posts/456',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/456$/),
Expand Down Expand Up @@ -111,7 +111,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page })
'sentry.source': 'route',
'sentry.origin': 'auto.navigation.react.tanstack_router',
'sentry.op': 'navigation',
'url.path.params.postId': '2',
'url.path.parameter.postId': '2',
'url.template': '/posts/$postId',
'url.path': '/posts/2',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/2$/),
Expand Down Expand Up @@ -151,7 +151,7 @@ test('sends a pageload transaction with resolved URL attrs after same-route redi
'sentry.source': 'route',
'sentry.origin': 'auto.pageload.react.tanstack_router',
'sentry.op': 'pageload',
'url.path.params.postId': '2',
'url.path.parameter.postId': '2',
'url.template': '/posts/$postId',
'url.path': '/posts/2',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/2$/),
Expand Down Expand Up @@ -187,7 +187,7 @@ test('sends a pageload transaction named after the resolved route when a redirec
'sentry.source': 'route',
'sentry.origin': 'auto.pageload.react.tanstack_router',
'sentry.op': 'pageload',
'url.path.params.postId': '1',
'url.path.parameter.postId': '1',
'url.template': '/posts/$postId',
'url.path': '/posts/1',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/1$/),
Expand Down Expand Up @@ -228,7 +228,7 @@ test('sends a navigation transaction when a redirect is thrown in beforeLoad', a
'sentry.source': 'route',
'sentry.origin': 'auto.navigation.react.tanstack_router',
'sentry.op': 'navigation',
'url.path.params.postId': '1',
'url.path.parameter.postId': '1',
'url.template': '/posts/$postId',
'url.path': '/posts/1',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/1$/),
Expand Down Expand Up @@ -265,7 +265,7 @@ test('sends a navigation transaction for a normal navigation that happens after
const navigationTxnPromise = waitForTransaction('tanstack-router', async transactionEvent => {
return (
transactionEvent.contexts?.trace?.op === 'navigation' &&
transactionEvent.contexts?.trace?.data?.['url.path.params.postId'] === '2'
transactionEvent.contexts?.trace?.data?.['url.path.parameter.postId'] === '2'
);
});

Expand All @@ -280,7 +280,7 @@ test('sends a navigation transaction for a normal navigation that happens after
'sentry.source': 'route',
'sentry.origin': 'auto.navigation.react.tanstack_router',
'sentry.op': 'navigation',
'url.path.params.postId': '2',
'url.path.parameter.postId': '2',
'url.template': '/posts/$postId',
'url.path': '/posts/2',
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/2$/),
Expand Down
1 change: 0 additions & 1 deletion packages/react/src/tanstackrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ function routeMatchToParamSpanAttributes(match: VendoredTanstackRouterRouteMatch

const paramAttributes: Record<string, string> = {};
Object.entries(match.params).forEach(([key, value]) => {
paramAttributes[`url.path.params.${key}`] = value; // TODO(v11): remove attribute which does not adhere to Sentry's semantic convention
paramAttributes[`${URL_PATH_PARAMETER_KEY_BASE}.${key}`] = value;
paramAttributes[`${PARAMS_KEY_BASE}.${key}`] = value; // params.[key] is an alias
});
Expand Down
3 changes: 1 addition & 2 deletions packages/react/test/tanstackrouter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => {
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
[URL_TEMPLATE]: '/posts/$postId',
'url.path.params.postId': '999',
'url.path.parameter.postId': '999',
}),
});
});
Expand Down Expand Up @@ -156,7 +156,6 @@ describe('tanstackRouterBrowserTracingIntegration', () => {
[URL_TEMPLATE]: '/posts/$postId',
'url.path': '/posts/2',
'url.full': expect.any(String),
'url.path.params.postId': '2',
'url.path.parameter.postId': '2',
'params.postId': '2',
}),
Expand Down
Loading