Skip to content

feat(ember): Set url.template, url.path and url.full on router spans#22095

Merged
Lms24 merged 4 commits into
developfrom
feat/pageload-url-attrs-ember
Jul 9, 2026
Merged

feat(ember): Set url.template, url.path and url.full on router spans#22095
Lms24 merged 4 commits into
developfrom
feat/pageload-url-attrs-ember

Conversation

@Lms24

@Lms24 Lms24 commented Jul 8, 2026

Copy link
Copy Markdown
Member

Emit url.template, url.path, and url.full on Ember pageload and navigation root spans so Ember aligns with the other framework router instrumentations in this stack.

Navigation spans set URL attributes at routeDidChange via routerService.currentURL, once the destination route is finalized. Dynamic path segments are parameterized into url.template (e.g. /users/123/users/:user_id).

E2E coverage was added for both ember-classic and ember-embroider, plus unit tests for the URL attribute helpers.

Stacked on #22091.

@Lms24 Lms24 requested a review from a team as a code owner July 8, 2026 14:25
@Lms24 Lms24 requested review from chargome, mydea and s1gr1d and removed request for a team July 8, 2026 14:25
Comment thread packages/ember/addon/utils/instrumentEmberAppInstanceForPerformance.ts Outdated
@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.62 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 - -
@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.78 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.3 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.26 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 282.95 kB - -
@sentry/nextjs (client) 51.16 kB - -
@sentry/sveltekit (client) 46.78 kB - -
@sentry/core/server 78.42 kB - -
@sentry/core/browser 64.74 kB - -
@sentry/node-core 62.72 kB -0.01% -2 B 🔽
@sentry/node 125.37 kB - -
@sentry/node (incl. diagnostics channel injection) 138.54 kB - -
@sentry/node/import (ESM hook with diagnostics-channel injection) 69.95 kB - -
@sentry/node/light 50.72 kB - -
@sentry/node - without tracing 74.06 kB - -
@sentry/aws-serverless 83.24 kB - -
@sentry/cloudflare (withSentry) - minified 181.71 kB - -
@sentry/cloudflare (withSentry) 449.16 kB - -

View base workflow run

@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from ff5adcc to be1c420 Compare July 8, 2026 14:41
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from aa52df6 to 45fa82b Compare July 8, 2026 14:41
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from be1c420 to ff5adcc Compare July 8, 2026 14:42
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 45fa82b to 659f478 Compare July 8, 2026 14:42
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from ff5adcc to be1c420 Compare July 8, 2026 14:43
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 659f478 to 45fa82b Compare July 8, 2026 14:43
Comment thread packages/ember/addon/utils/instrumentEmberAppInstanceForPerformance.ts Outdated
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from be1c420 to ff5adcc Compare July 8, 2026 14:46
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 45fa82b to 659f478 Compare July 8, 2026 14:46
Comment thread packages/ember/addon/utils/instrumentEmberAppInstanceForPerformance.ts Outdated
Comment thread packages/ember/addon/utils/instrumentEmberAppInstanceForPerformance.ts Outdated
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from ff5adcc to a40f18b Compare July 8, 2026 14:52
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 659f478 to 610bc80 Compare July 8, 2026 14:52
Comment thread packages/ember/addon/utils/instrumentEmberAppInstanceForPerformance.ts Outdated
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 610bc80 to cfee70c Compare July 8, 2026 14:57
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch 2 times, most recently from 6265a7c to ffde4cb Compare July 8, 2026 15:00
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 6a4e140 to afa64b0 Compare July 8, 2026 15:00
Comment thread packages/ember/addon/utils/instrumentEmberAppInstanceForPerformance.ts Outdated
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from ffde4cb to c2ee1fa Compare July 8, 2026 16:08
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from a020c02 to acde345 Compare July 9, 2026 07:54
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 219838a to 7b29fa4 Compare July 9, 2026 07:54
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from acde345 to a698c2c Compare July 9, 2026 10:30
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch 2 times, most recently from 7c681a3 to e96660f Compare July 9, 2026 10:30
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from a698c2c to 9a2444e Compare July 9, 2026 10:30
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from e96660f to 1675c6e Compare July 9, 2026 11:28
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from 9a2444e to ae419a9 Compare July 9, 2026 11:28
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 1675c6e to cc62a5f Compare July 9, 2026 12:57
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch 2 times, most recently from 584269b to cb61d0b Compare July 9, 2026 12:58
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from cc62a5f to 24c2c27 Compare July 9, 2026 12:58
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from cb61d0b to a0eea1a Compare July 9, 2026 14:00
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 24c2c27 to 638f200 Compare July 9, 2026 14:00

const targetUrl =
(transition as TransitionWithIntent).intent?.url ?? _getLocationURL(location);
const urlAttributes = _getRouteUrlAttributes(targetUrl, transition.to?.params);

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: For nested dynamic routes, transition.to?.params only provides leaf route parameters, resulting in an incomplete URL template for the transaction name.
Severity: MEDIUM

Suggested Fix

To fix this, the code should traverse the route hierarchy to collect parameters from all parent routes, not just the leaf route. This can be done by iterating through the transition's routes and aggregating all params objects before calling buildUrlTemplate.

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/ember/addon/utils/instrumentEmberAppInstanceForPerformance.ts#L185

Potential issue: When a navigation transition occurs to a nested dynamic route (e.g.,
`/users/:user_id/posts/:post_id`), the code uses `transition.to?.params` to gather route
parameters. This object only contains parameters for the final leaf route (e.g., `{
post_id: '456' }`), excluding parameters from parent routes (e.g., `{ user_id: '123'
}`). This leads to the `buildUrlTemplate` function generating an incomplete URL
template, such as `/users/123/posts/:post_id` instead of the correct
`/users/:user_id/posts/:post_id`. This will result in incorrect transaction names for
applications using this common routing pattern.

@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-frameworks branch from a0eea1a to e018d44 Compare July 9, 2026 15:54
@Lms24 Lms24 changed the base branch from feat/pageload-url-attrs-frameworks to develop July 9, 2026 15:55
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 638f200 to ee82dda Compare July 9, 2026 15:55

@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.

There are 2 total unresolved issues (including 1 from previous review).

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 ee82dda. Configure here.

Comment thread packages/angular/src/tracing.ts
Lms24 and others added 2 commits July 9, 2026 19:29
Emit standard URL attributes on Ember pageload and navigation root spans,
updating navigation attributes at routeDidChange once the destination URL
is finalized.

Co-Authored-By: Cursor <cursoragent@cursor.com>
At `routeWillChange` the router's location still points at the current
(pre-transition) route, so falling back to it when `transition.intent.url`
is missing tagged the navigation root span with the previous route's
`url.path`, `url.template`, and `url.full` until `routeDidChange` corrected
them. Only use `intent.url` when available and otherwise defer the url
attributes to `routeDidChange`, which reads them from `currentURL`.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Lms24 Lms24 force-pushed the feat/pageload-url-attrs-ember branch from 738909d to 8c71aa7 Compare July 9, 2026 17:29
Comment thread packages/ember/addon/utils/instrumentEmberAppInstanceForPerformance.ts Outdated
`_getRouteUrlAttributes` built `url.full` from the hash-stripped route
path, so hash-location apps lost their `#/...` fragment (turning
`https://host/#/tracing` into `https://host/tracing`). On `routeDidChange`
this was compounded by using `currentURL`, which is the normalized route
path and never carries the hash.

Derive `url.full` from the unstripped URL and, on `routeDidChange`, source
it from the location URL while keeping `currentURL` for path/template.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Cursor <cursoragent@cursor.com>
@Lms24 Lms24 merged commit 256b9b9 into develop Jul 9, 2026
48 checks passed
@Lms24 Lms24 deleted the feat/pageload-url-attrs-ember branch July 9, 2026 18:34
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