Skip to content

Commit a7421ca

Browse files
Lms24JPeer264
authored andcommitted
ref(react)!: Remove redundant url.path.params.<key> attribute (#23506)
This PR removes the undocumented `url.path.params.<key>` in favour of the already set and [documented](https://getsentry.github.io/sentry-conventions/attributes/url/#url-path-parameter-key) `url.path.parameter.<key>` attribute.
1 parent f8024fd commit a7421ca

5 files changed

Lines changed: 13 additions & 14 deletions

File tree

‎MIGRATION.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ Two consequences to be aware of when upgrading:
523523
Affected SDKs: All SDKs.
524524

525525
- The `http.query` and `http.fragment` span attributes were renamed to `url.query` and `url.fragment`.
526+
- 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.
526527
- 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`.
527528
- The `gen_ai.system` span attribute was renamed to `gen_ai.provider.name` across all AI integrations.
528529
- The `gen_ai.request.available_tools` span attribute was renamed to `gen_ai.tool.definitions` across all AI integrations.

‎dev-packages/e2e-tests/test-applications/tanstack-router/tests/basepath.test.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ test.describe('router basepath', () => {
2424
// match already set, so the stale `a`/`b`/`c` params survive on the span. Keys are passed as
2525
// arrays because `toHaveProperty` would otherwise read the dots as a nested lookup.
2626
const traceData = rootSpan.contexts?.trace?.data;
27-
expect(traceData).not.toHaveProperty(['url.path.params.a']);
28-
expect(traceData).not.toHaveProperty(['url.path.params.b']);
29-
expect(traceData).not.toHaveProperty(['url.path.params.c']);
30-
expect(traceData).toHaveProperty(['url.path.params.postId'], '456');
27+
expect(traceData).not.toHaveProperty(['url.path.parameter.a']);
28+
expect(traceData).not.toHaveProperty(['url.path.parameter.b']);
29+
expect(traceData).not.toHaveProperty(['url.path.parameter.c']);
30+
expect(traceData).toHaveProperty(['url.path.parameter.postId'], '456');
3131
expect(traceData).toHaveProperty(['url.template'], '/posts/$postId');
3232
});
3333

‎dev-packages/e2e-tests/test-applications/tanstack-router/tests/routing-instrumentation.test.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) =
1919
'sentry.source': 'route',
2020
'sentry.origin': 'auto.pageload.react.tanstack_router',
2121
'sentry.op': 'pageload',
22-
'url.path.params.postId': '456',
22+
'url.path.parameter.postId': '456',
2323
'url.template': '/posts/$postId',
2424
'url.path': '/posts/456',
2525
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/456$/),
@@ -111,7 +111,7 @@ test('sends a navigation transaction with a parameterized URL', async ({ page })
111111
'sentry.source': 'route',
112112
'sentry.origin': 'auto.navigation.react.tanstack_router',
113113
'sentry.op': 'navigation',
114-
'url.path.params.postId': '2',
114+
'url.path.parameter.postId': '2',
115115
'url.template': '/posts/$postId',
116116
'url.path': '/posts/2',
117117
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/2$/),
@@ -151,7 +151,7 @@ test('sends a pageload transaction with resolved URL attrs after same-route redi
151151
'sentry.source': 'route',
152152
'sentry.origin': 'auto.pageload.react.tanstack_router',
153153
'sentry.op': 'pageload',
154-
'url.path.params.postId': '2',
154+
'url.path.parameter.postId': '2',
155155
'url.template': '/posts/$postId',
156156
'url.path': '/posts/2',
157157
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/2$/),
@@ -187,7 +187,7 @@ test('sends a pageload transaction named after the resolved route when a redirec
187187
'sentry.source': 'route',
188188
'sentry.origin': 'auto.pageload.react.tanstack_router',
189189
'sentry.op': 'pageload',
190-
'url.path.params.postId': '1',
190+
'url.path.parameter.postId': '1',
191191
'url.template': '/posts/$postId',
192192
'url.path': '/posts/1',
193193
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/1$/),
@@ -228,7 +228,7 @@ test('sends a navigation transaction when a redirect is thrown in beforeLoad', a
228228
'sentry.source': 'route',
229229
'sentry.origin': 'auto.navigation.react.tanstack_router',
230230
'sentry.op': 'navigation',
231-
'url.path.params.postId': '1',
231+
'url.path.parameter.postId': '1',
232232
'url.template': '/posts/$postId',
233233
'url.path': '/posts/1',
234234
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/1$/),
@@ -265,7 +265,7 @@ test('sends a navigation transaction for a normal navigation that happens after
265265
const navigationTxnPromise = waitForTransaction('tanstack-router', async transactionEvent => {
266266
return (
267267
transactionEvent.contexts?.trace?.op === 'navigation' &&
268-
transactionEvent.contexts?.trace?.data?.['url.path.params.postId'] === '2'
268+
transactionEvent.contexts?.trace?.data?.['url.path.parameter.postId'] === '2'
269269
);
270270
});
271271

@@ -280,7 +280,7 @@ test('sends a navigation transaction for a normal navigation that happens after
280280
'sentry.source': 'route',
281281
'sentry.origin': 'auto.navigation.react.tanstack_router',
282282
'sentry.op': 'navigation',
283-
'url.path.params.postId': '2',
283+
'url.path.parameter.postId': '2',
284284
'url.template': '/posts/$postId',
285285
'url.path': '/posts/2',
286286
'url.full': expect.stringMatching(/^https?:\/\/localhost:\d+\/posts\/2$/),

‎packages/react/src/tanstackrouter.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ function routeMatchToParamSpanAttributes(match: VendoredTanstackRouterRouteMatch
207207

208208
const paramAttributes: Record<string, string> = {};
209209
Object.entries(match.params).forEach(([key, value]) => {
210-
paramAttributes[`url.path.params.${key}`] = value; // TODO(v11): remove attribute which does not adhere to Sentry's semantic convention
211210
paramAttributes[`${URL_PATH_PARAMETER_KEY_BASE}.${key}`] = value;
212211
paramAttributes[`${PARAMS_KEY_BASE}.${key}`] = value; // params.[key] is an alias
213212
});

‎packages/react/test/tanstackrouter.test.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ describe('tanstackRouterBrowserTracingIntegration', () => {
8787
[SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN]: 'auto.pageload.react.tanstack_router',
8888
[SEMANTIC_ATTRIBUTE_SENTRY_SOURCE]: 'route',
8989
[URL_TEMPLATE]: '/posts/$postId',
90-
'url.path.params.postId': '999',
90+
'url.path.parameter.postId': '999',
9191
}),
9292
});
9393
});
@@ -156,7 +156,6 @@ describe('tanstackRouterBrowserTracingIntegration', () => {
156156
[URL_TEMPLATE]: '/posts/$postId',
157157
'url.path': '/posts/2',
158158
'url.full': expect.any(String),
159-
'url.path.params.postId': '2',
160159
'url.path.parameter.postId': '2',
161160
'params.postId': '2',
162161
}),

0 commit comments

Comments
 (0)