Skip to content

Support getTraceData for custom scope #16618

Closed
@jkjustjoshing

Description

@jkjustjoshing

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

To avoid conflicts with the base website's Sentry instance, I'm following the instructions for a shared environment. 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.

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

Solution Brainstorm

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions