Class OpenTelemetrySdkAccess


  • public final class OpenTelemetrySdkAccess
    extends java.lang.Object
    A helper to facilitate accessing OpenTelemetry SDK methods from instrumentation. Because instrumentation runs in the app classloader, they do not have access to our SDK in the agent classloader. So we use this class in the bootstrap classloader to bridge between the two - the agent classloader will register implementations of needed SDK functions that can be called from instrumentation.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  OpenTelemetrySdkAccess.ForceFlusher
      Interface matching io.opentelemetry.sdk.trace.TracerSdkProvider#forceFlush() to allow holding a reference to it.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void forceFlush​(int timeout, java.util.concurrent.TimeUnit unit)
      Forces flush of pending spans and metrics.
      static void internalSetForceFlush​(OpenTelemetrySdkAccess.ForceFlusher forceFlush)
      Sets the Runnable to execute when instrumentation needs to force flush.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • forceFlush

        public static void forceFlush​(int timeout,
                                      java.util.concurrent.TimeUnit unit)
        Forces flush of pending spans and metrics.
      • internalSetForceFlush

        public static void internalSetForceFlush​(OpenTelemetrySdkAccess.ForceFlusher forceFlush)
        Sets the Runnable to execute when instrumentation needs to force flush. This is called from the agent classloader to execute the SDK's force flush mechanism. Instrumentation must not call this.