feat(vue): Set url.template and URL attributes on router spans#22063
feat(vue): Set url.template and URL attributes on router spans#22063Lms24 wants to merge 2 commits into
Conversation
05dc30a to
f1c9b06
Compare
8dcf8d2 to
4b0a201
Compare
| paramAttributes[URL_PATH_PARAMETER_KEY.replace('<key>', key)] = value; | ||
| paramAttributes[PARAMS_KEY.replace('<key>', key)] = value; // params.[key] is an alias |
There was a problem hiding this comment.
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).
size-limit report 📦
|
f1c9b06 to
74f040c
Compare
4b0a201 to
0efa7ff
Compare
0efa7ff to
b3142f9
Compare
71d705f to
0d98fb5
Compare
b3142f9 to
26631c4
Compare
26631c4 to
a4979c5
Compare
0d98fb5 to
4d6b4b9
Compare
a4979c5 to
26631c4
Compare
4d6b4b9 to
0d98fb5
Compare
26631c4 to
a4979c5
Compare
0d98fb5 to
4d6b4b9
Compare
a4979c5 to
26631c4
Compare
4d6b4b9 to
0d98fb5
Compare
26631c4 to
5b4c45f
Compare
0d98fb5 to
4b134c2
Compare
5b4c45f to
735d7ef
Compare
4b134c2 to
25c6e76
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
25c6e76 to
6165ba8
Compare
735d7ef to
59ab726
Compare
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>
59ab726 to
7668b4b
Compare
6165ba8 to
08f5a34
Compare
| paramAttributes[URL_PATH_PARAMETER_KEY.replace('<key>', key)] = value; | ||
| paramAttributes[PARAMS_KEY.replace('<key>', key)] = value; // params.[key] is an alias |
There was a problem hiding this comment.
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

Adds
url.template,url.path, andurl.fullto Vue Router and TanStack Vue Router pageload and navigation spans. Navigation spans now pass the destination URL when started sourl.pathandurl.fullreflect 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