Skip to content

Provide a way to set IScopesStorage using SentryOptions #5193

@Fabccc

Description

@Fabccc

Problem Statement

I want to set a scope storage compatible with Quarkus reactive core (Vertx), because the DefaultScopeStorage backed by ThreadLocal variables does not meet the "no pinning" condition, and a single thread can handle multiple requests, so it will cause weird behaviour. Currently I have to use reflection to override the field value, since it's marked private static. I also have to re-create a scope from the global scope, and it's just a duplicate.

Solution Brainstorm

I think we should be able to set a custom IScopesStorage implementation in SentryOptions (passed to the init method). Inside the "Sentry#initForOpenTelemetryMaybe", we could maybe check for an existing scopeStorage in the SentryOptions parameters. If there is a non null value, then set the "scopesStorage" field value to the value, otherwise, fallback to classic behaviour. It should not impact current users setup.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions