Class ContextHandleUtils


  • public class ContextHandleUtils
    extends java.lang.Object
    • Field Detail

      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • CONTEXT_MANAGER

        private static final ContextManager CONTEXT_MANAGER
    • Constructor Detail

      • ContextHandleUtils

        private ContextHandleUtils()
    • Method Detail

      • loadContextManager

        private static ContextManager loadContextManager​(@Nullable
                                                         java.lang.ClassLoader classLoader)
      • 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.