Class ContextHandleUtils

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

public class ContextHandleUtils extends Object
  • Method Details

    • 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.