Title: UI profiling: idle samples are attributed to stack 0 in convertToContinuousProfile · Issue #25757 · getsentry/sentry-javascript · GitHub
Open Graph Title: UI profiling: idle samples are attributed to stack 0 in convertToContinuousProfile · Issue #25757 · getsentry/sentry-javascript
X Title: UI profiling: idle samples are attributed to stack 0 in convertToContinuousProfile · Issue #25757 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I searched the repo for "idle", "stackId" and "UI profiling" issues and found none. SDK and version @sentry/browser 10.76.2. The same code is on develop in packages/browser/src/profiling/utils.ts. Des...
Open Graph Description: Is there an existing issue for this? I searched the repo for "idle", "stackId" and "UI profiling" issues and found none. SDK and version @sentry/browser 10.76.2. The same code is on develop in pack...
X Description: Is there an existing issue for this? I searched the repo for "idle", "stackId" and "UI profiling" issues and found none. SDK and version @sentry/browser 10.76.2. The s...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25757
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"UI profiling: idle samples are attributed to stack 0 in convertToContinuousProfile","articleBody":"### Is there an existing issue for this?\n\nI searched the repo for \"idle\", \"stackId\" and \"UI profiling\" issues and found none.\n\n### SDK and version\n\n`@sentry/browser` 10.76.2. The same code is on `develop` in `packages/browser/src/profiling/utils.ts`.\n\n### Description\n\n`convertToContinuousProfile` writes a JS Self-Profiling sample that has no `stackId` as `stack_id: sample.stackId ?? 0`. A sample without a `stackId` means that the thread was idle. Stack 0 is a real stack: the first stack that the profiler recorded in the chunk. So the SDK reports every idle sample in the chunk as time spent in the frames of stack 0.\n\nThe legacy converter, `convertJSSelfProfileToSampledFormat`, handles the same case correctly. It adds one empty stack and points every idle sample at it.\n\n### Impact\n\nWith `profileLifecycle: 'trace'`, a root span often starts the profiler from inside a timer or event callback. Stack 0 is then rooted at the SDK's own `sentryWrapped` wrapper (`helpers.ts`), plus the callback that started the span. A parentless `http.client` root span that waits 2 s on the network then shows in the flame graph as about 2 s of main-thread time in `sentryWrapped`. In one of our production chunks, the wrapper frame was in 429 of 430 samples, and no other frame was in more than 1. Because of this, a third-party telemetry request looked as if it blocked the main thread.\n\n### Steps to reproduce\n\nWe found this by reading the code and checking production profiles. We did not run the steps below in isolation.\n\n1. Call `Sentry.init` with `browserProfilingIntegration()`, `profileLifecycle: 'trace'`, `profileSessionSampleRate: 1` and `tracesSampleRate: 1`. Use Chrome, and serve the page with `Document-Policy: js-profiling`.\n2. From a `setTimeout` callback, start a root span and keep it open for 2 s while the page is idle. For example, send an XHR to a slow endpoint while span streaming is on.\n3. Open the continuous profile for that window.\n\n### Expected result\n\nIdle samples have an empty stack, as in the legacy format. The flame graph shows the thread as idle.\n\n### Actual result\n\nIdle samples point to stack 0. The flame graph shows the callback's stack as busy for the whole window.\n\n### Suggested fix\n\nDo what the legacy converter does. On the first idle sample, add one empty stack, and point every idle sample at its index instead of at `0`.\n","author":{"url":"https://github.com/igor-goldny","@type":"Person","name":"igor-goldny"},"datePublished":"2026-10-27T11:37:45Z","url":"https://github.com/getsentry/sentry-javascript/issues/25757"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:35d4f2c0-db76-7223-f7a7-b0ddeb142379 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C5BC:C24D0:273E5C:36D7C8:6B047453 |
| html-safe-nonce | 8e68b026f9e8158f175fa2ff064e2cba30db0c04c02ed4bbaced69cade32691a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNUJDOkMyNEQwOjI3M0U1QzozNkQ3Qzg6NkIwNDc0NTMiLCJ2aXNpdG9yX2lkIjoiNjQ2NjM5NTAxOTEwMzQ2NjU4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4d8a98026f1a0adea3f627d3526e1ac54a31cfff5f3c9b88fa4f90f48038442d |
| hovercard-subject-tag | issue:6058422333 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25757/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5e41d27cd577e48268eaf02427d0a7e253ff3f439daa91aa8dc2b86831a40197/getsentry/sentry-javascript/issues/25757 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5e41d27cd577e48268eaf02427d0a7e253ff3f439daa91aa8dc2b86831a40197/getsentry/sentry-javascript/issues/25757 |
| og:image:alt | Is there an existing issue for this? I searched the repo for "idle", "stackId" and "UI profiling" issues and found none. SDK and version @sentry/browser 10.76.2. The same code is on develop in pack... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | igor-goldny |
| hostname | github.com |
| expected-hostname | github.com |
| None | ae8802492f12d3ba4f6b0d814054e617a2a5616b6327bf8555c10cd5b0dc2a6f |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cfb5f24c6e01d85f70804652a5107e5cac03a161 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width