Class ContextHandleUtils

java.lang.Object
io.opencensus.trace.unsafe.ContextHandleUtils

public class ContextHandleUtils extends Object
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • CONTEXT_MANAGER

      private static final ContextManager CONTEXT_MANAGER
  • Constructor Details

    • ContextHandleUtils

      private ContextHandleUtils()
  • Method Details

    • loadContextManager

      private static ContextManager loadContextManager(@Nullable ClassLoader classLoader)
    • currentContext

      public static ContextHandle currentContext()
    • withValue

      public static ContextHandle withValue(ContextHandle context, @Nullable Span span)
      Creates a new ContextHandle with the given value set.
      Parameters:
      context - the parent ContextHandle.
      span - the value to be set.
      Returns:
      a new context with the given value set.
    • getValue

      public static Span getValue(ContextHandle context)
      Returns the value from the specified ContextHandle.
      Parameters:
      context - the specified ContextHandle.
      Returns:
      the value from the specified ContextHandle.
    • tryExtractGrpcContext

      @Nullable public static io.grpc.Context tryExtractGrpcContext(ContextHandle handle)
      Attempts to pull the Context out of an OpenCensus ContextHandle.
      Returns:
      The context, or null if not a GRPC backed context handle.