Skip to content

Integrate Sentry OTel with External Context Storage Providers #4339

@gilday

Description

@gilday

Problem Statement

When using Sentry SDK 8.0.0+ with frameworks that provide their own OpenTelemetry ContextStorageProvider implementations (like Quarkus), we experience initialization conflicts:

WARNING: ContextStorageProvider initialized failed. Using default
java.lang.IllegalStateException: Found multiple ContextStorageProvider. Set the io.opentelemetry.context.ContextStorageProvider property to the fully qualified class name of the provider to use.
This occurs because both Sentry and frameworks like Quarkus register their own ContextStorageProvider implementations, but OpenTelemetry can only use one.

Please provide official support for integrating Sentry's OpenTelemetry implementation with external ContextStorageProvider implementations. Specifically:

  1. An option to configure Sentry to use an existing ContextStorageProvider instead of registering its own
  2. Clear documentation on how to properly integrate Sentry with frameworks that have their own OpenTelemetry context implementations
  3. Hooks or extension points for customizing how Sentry interacts with OpenTelemetry context

Quarkus applications need the Quarkus ContextStorageProvider for proper Vert.x integration and reactive context propagation. Meanwhile, Sentry needs access to the context for proper scope and tracing management.
We would like to use Sentry's rich error reporting capabilities while preserving the framework's context propagation mechanisms.

Solution Brainstorm

To workaround this issue, we're considering:

  1. Setting the system property to use the Quarkus provider (but unsure if Sentry will function properly)
  2. Creating a combined provider that wraps both implementations (complex and potentially fragile)

Official support would provide a cleaner, maintainable solution for all Sentry users working with these frameworks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions