Skip to content

feat(vue): Set url.template and URL attributes on router spans#22063

Open
Lms24 wants to merge 2 commits into
feat/pageload-url-attrs-sveltekitfrom
feat/pageload-url-attrs-vue
Open

feat(vue): Set url.template and URL attributes on router spans#22063
Lms24 wants to merge 2 commits into
feat/pageload-url-attrs-sveltekitfrom
feat/pageload-url-attrs-vue

Conversation

@Lms24

@Lms24 Lms24 commented Jul 8, 2026

Copy link
Copy Markdown
Member

Adds url.template, url.path, and url.full to Vue Router and TanStack Vue Router pageload and navigation spans. Navigation spans now pass the destination URL when started so url.path and url.full reflect the target route rather than the previous page. Redirect resolution in TanStack Router also updates URL attributes on pageload and navigation spans.

Part of #21921

@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch from 05dc30a to f1c9b06 Compare July 8, 2026 09:29
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from 8dcf8d2 to 4b0a201 Compare July 8, 2026 09:29
@Lms24 Lms24 changed the title feat/pageload url attrs vue feat(vue): Set url.template and URL attributes on router spans Jul 8, 2026
Comment on lines +204 to +205
paramAttributes[URL_PATH_PARAMETER_KEY.replace('<key>', key)] = value;
paramAttributes[PARAMS_KEY.replace('<key>', key)] = value; // params.[key] is an alias

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically extra credit but I figued I'd give it a shot in this PR. Not fully happy with how we build the key here but for now this is how conventions emit dynamic attribute keys. The advantage we still get over hard-coded keys is that we'd get a deprecation if one of the params becomes deprecated (which, given they're aliases of each other, is quite likely IMHO).

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.59 kB - -
@sentry/browser - with treeshaking flags 26.03 kB - -
@sentry/browser (incl. Tracing) 46.34 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.13 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.12 kB - -
@sentry/browser (incl. Tracing, Replay) 85.61 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.26 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.32 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 102.97 kB - -
@sentry/browser (incl. Feedback) 44.76 kB - -
@sentry/browser (incl. sendFeedback) 32.38 kB - -
@sentry/browser (incl. FeedbackAsync) 37.51 kB - -
@sentry/browser (incl. Metrics) 28.67 kB - -
@sentry/browser (incl. Logs) 28.91 kB - -
@sentry/browser (incl. Metrics & Logs) 29.59 kB - -
@sentry/react 29.38 kB - -
@sentry/react (incl. Tracing) 48.61 kB - -
@sentry/vue 33.03 kB - -
@sentry/vue (incl. Tracing) 48.3 kB +0.12% +57 B 🔺
@sentry/svelte 27.61 kB - -
CDN Bundle 30 kB - -
CDN Bundle (incl. Tracing) 48.32 kB - -
CDN Bundle (incl. Logs, Metrics) 31.57 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.64 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.81 kB - -
CDN Bundle (incl. Tracing, Replay) 85.84 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.14 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.64 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.92 kB - -
CDN Bundle - uncompressed 89.35 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.1 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.05 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.07 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 218.75 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.27 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.23 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 278.97 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.92 kB - -
@sentry/nextjs (client) 51.16 kB - -
@sentry/sveltekit (client) 46.78 kB +0.06% +26 B 🔺
@sentry/core/server 78.42 kB - -
@sentry/core/browser 64.74 kB - -
@sentry/node-core 62.72 kB -0.01% -1 B 🔽
@sentry/node 124.6 kB - -
@sentry/node (incl. diagnostics channel injection) 134.02 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.72 kB +0.01% +1 B 🔺
@sentry/node - without tracing 74.05 kB -0.01% -1 B 🔽
@sentry/aws-serverless 85.5 kB +0.01% +1 B 🔺
@sentry/cloudflare (withSentry) - minified 181.69 kB - -
@sentry/cloudflare (withSentry) 449.12 kB - -

View base workflow run

@Lms24 Lms24 marked this pull request as ready for review July 8, 2026 10:08
@Lms24 Lms24 requested a review from a team as a code owner July 8, 2026 10:08
@Lms24 Lms24 requested review from chargome, mydea and s1gr1d and removed request for a team July 8, 2026 10:08
Comment thread packages/vue/src/tanstackrouter.ts
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch from f1c9b06 to 74f040c Compare July 8, 2026 12:29
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from 4b0a201 to 0efa7ff Compare July 8, 2026 12:29
Comment thread packages/vue/src/tanstackrouter.ts
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from 0efa7ff to b3142f9 Compare July 8, 2026 13:11
@Lms24 Lms24 requested a review from a team as a code owner July 8, 2026 13:11
@Lms24 Lms24 requested review from logaretm and removed request for a team July 8, 2026 13:11
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch 2 times, most recently from 71d705f to 0d98fb5 Compare July 8, 2026 14:22
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from b3142f9 to 26631c4 Compare July 8, 2026 14:22
Comment thread packages/vue/src/router.ts
Comment thread packages/vue/src/tanstackrouter.ts
Comment thread packages/vue/src/router.ts
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from 26631c4 to a4979c5 Compare July 8, 2026 14:41
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch from 0d98fb5 to 4d6b4b9 Compare July 8, 2026 14:41
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from a4979c5 to 26631c4 Compare July 8, 2026 14:42
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch from 4d6b4b9 to 0d98fb5 Compare July 8, 2026 14:42
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from 26631c4 to a4979c5 Compare July 8, 2026 14:43
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch from 0d98fb5 to 4d6b4b9 Compare July 8, 2026 14:43
Comment thread packages/vue/src/router.ts
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from a4979c5 to 26631c4 Compare July 8, 2026 14:46
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch from 4d6b4b9 to 0d98fb5 Compare July 8, 2026 14:46
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from 26631c4 to 5b4c45f Compare July 8, 2026 14:52
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch from 0d98fb5 to 4b134c2 Compare July 8, 2026 14:52
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from 5b4c45f to 735d7ef Compare July 8, 2026 14:57
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch from 4b134c2 to 25c6e76 Compare July 8, 2026 14:57

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 25c6e76. Configure here.

Comment thread packages/vue/src/tanstackrouter.ts
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch from 25c6e76 to 6165ba8 Compare July 8, 2026 15:00
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from 735d7ef to 59ab726 Compare July 8, 2026 15:00
Adds url.template to Vue Router and TanStack Vue Router pageload and
navigation spans, passes destination URLs when starting navigation
spans, and adds e2e test coverage for url.full, url.path, and
url.template.

part of #21921

Co-Authored-By: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-sveltekit branch from 59ab726 to 7668b4b Compare July 8, 2026 16:08
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-vue branch from 6165ba8 to 08f5a34 Compare July 8, 2026 16:08
Comment on lines +204 to +205
paramAttributes[URL_PATH_PARAMETER_KEY.replace('<key>', key)] = value;
paramAttributes[PARAMS_KEY.replace('<key>', key)] = value; // params.[key] is an alias

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The code assumes external constants URL_PATH_PARAMETER_KEY and PARAMS_KEY use <key> as a placeholder for replacement. If this assumption is wrong, route parameter attributes will be overwritten.
Severity: HIGH

Suggested Fix

Verify the actual string values of URL_PATH_PARAMETER_KEY and PARAMS_KEY from the @sentry/conventions package. If the placeholder is not <key>, either update the code to use the correct placeholder or revert to direct string interpolation, like `url.path.parameter.${key}`, to ensure correctness.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: packages/vue/src/tanstackrouter.ts#L204-L205

Potential issue: The code replaces a placeholder in `URL_PATH_PARAMETER_KEY` and
`PARAMS_KEY` constants imported from the external `@sentry/conventions` package.
However, it is not verified that these constants actually contain the literal string
`<key>` as a placeholder. If the constants use a different placeholder format (e.g.,
`{key}`) or no placeholder at all, the `.replace()` operation will fail silently. This
would cause all route parameters to be assigned to the same incorrect attribute key,
leading to parameter data being overwritten and lost during instrumentation.

Also affects:

  • packages/vue/src/router.ts:77~78

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants