Class SentryOtelThreadLocalStorage

java.lang.Object
io.sentry.opentelemetry.SentryOtelThreadLocalStorage
All Implemented Interfaces:
io.opentelemetry.context.ContextStorage

@Experimental @Internal public final class SentryOtelThreadLocalStorage extends Object implements io.opentelemetry.context.ContextStorage
Workaround to make OpenTelemetry context storage work for Sentry since Sentry sometimes forks Context without cleaning up. We are not yet sure if this is something we can easliy fix, since Sentry static API makes heavy use of getCurrentScopes and there is no easy way of knowing when to restore previous Context.
  • Constructor Details

    • SentryOtelThreadLocalStorage

      public SentryOtelThreadLocalStorage()
  • Method Details

    • attach

      public io.opentelemetry.context.Scope attach(io.opentelemetry.context.Context toAttach)
      Specified by:
      attach in interface io.opentelemetry.context.ContextStorage
    • current

      @Nullable public @Nullable io.opentelemetry.context.Context current()
      Specified by:
      current in interface io.opentelemetry.context.ContextStorage