Title: Support getTraceData for custom scope · Issue #16618 · getsentry/sentry-javascript · GitHub
Open Graph Title: Support getTraceData for custom scope · Issue #16618 · getsentry/sentry-javascript
X Title: Support getTraceData for custom scope · Issue #16618 · getsentry/sentry-javascript
Description: Problem Statement I'm building a browser extension with a content script, service worker, and side panel. I'd like to capture a trace that starts with a span for a click on the browser page from the content script, and includes spans fro...
Open Graph Description: Problem Statement I'm building a browser extension with a content script, service worker, and side panel. I'd like to capture a trace that starts with a span for a click on the browser page from th...
X Description: Problem Statement I'm building a browser extension with a content script, service worker, and side panel. I'd like to capture a trace that starts with a span for a click on the browser page...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/16618
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support getTraceData for custom scope","articleBody":"### Problem Statement\n\nI'm building a browser extension with a content script, service worker, and side panel. I'd like to capture a trace that starts with a span for a click on the browser page from the content script, and includes spans from the service worker and side panel. To do this, I need to pass the `sentry-trace` and `baggage` values from the content script to the service worker, and from the service worker to the side panel.\n\nTo avoid conflicts with the base website's Sentry instance, I'm following the [instructions for a shared environment](https://docs.sentry.io/platforms/javascript/best-practices/shared-environments/). I'm having trouble getting trace data in this context, and I suspect it's because traces aren't working correctly in the shared environment.\n\nBased on the lack of ability to pass `scope` to some of the trace methods, I suspect this may not be possible with the current SDK. I'd like to see this supported, and either way some documentation added to clarify the limits to how/where the tracing methods work.\n\n### Solution Brainstorm\n\n`getTraceData()`, `startSpan()`, and `startNewTrace()` should be callable on a scope. `startSpan()` already supports passing a `scope` in the options, maybe the other 2 should support that. I'm not sure what needs to happen under-the-hood to get this working (if anything).","author":{"url":"https://github.com/jkjustjoshing","@type":"Person","name":"jkjustjoshing"},"datePublished":"2025-06-17T14:08:52Z","url":"https://github.com/getsentry/sentry-javascript/issues/16618"}
| 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:8258261a-9872-4a15-ce46-3ded3cab3fa4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A776:32CBBB:2FD0975:400D8B7:6B06DCBC |
| html-safe-nonce | d250886b3558fb5423e6f4dac57813ebb810fc8244188c905f71e94ced57adb7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzc2OjMyQ0JCQjoyRkQwOTc1OjQwMEQ4Qjc6NkIwNkRDQkMiLCJ2aXNpdG9yX2lkIjoiMTQwODI1MTE5MTgyMTI2MjAxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | dcf0905ec5cab0c82d162f08e1a67cdd6d4ff2e3ce82c1b0e462bd3a8a5f1c01 |
| hovercard-subject-tag | issue:3153656166 |
| 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/16618/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d5483f7c9e5198b5d5f0300f43a99f94e41430b384f7ccbc060f993b681be6ec/getsentry/sentry-javascript/issues/16618 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d5483f7c9e5198b5d5f0300f43a99f94e41430b384f7ccbc060f993b681be6ec/getsentry/sentry-javascript/issues/16618 |
| og:image:alt | Problem Statement I'm building a browser extension with a content script, service worker, and side panel. I'd like to capture a trace that starts with a span for a click on the browser page from th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jkjustjoshing |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06cadd0061c549662a50be90eb5baba7608f00f521574931eec01db0deb9e636 |
| 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 | 6953c712585a8d7406b7695e48fffcb670fd241d |
| 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