Package io.opencensus.trace
Class CurrentSpanUtils
java.lang.Object
io.opencensus.trace.CurrentSpanUtils
Util methods/functionality to interact with the
Span
in the Context
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
private static final class
private static final class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static Span
Returns TheSpan
from the current context.private static void
setErrorStatus
(Span span, Throwable t) (package private) static Scope
Enters the scope of code where the givenSpan
is in the current context, and returns an object that represents that scope.(package private) static Runnable
(package private) static <C> Callable
<C>
-
Constructor Details
-
CurrentSpanUtils
private CurrentSpanUtils()
-
-
Method Details
-
getCurrentSpan
Returns TheSpan
from the current context.- Returns:
- The
Span
from the current context.
-
withSpan
Enters the scope of code where the givenSpan
is in the current context, and returns an object that represents that scope. The scope is exited when the returned object is closed.Supports try-with-resource idiom.
- Parameters:
span
- TheSpan
to be set to the current context.endSpan
- iftrue
the returnedScope
will close theSpan
.- Returns:
- An object that defines a scope where the given
Span
is set to the current context.
-
withSpan
- Parameters:
span
- theSpan
to be set as current.endSpan
- iftrue
the returnedRunnable
will close theSpan
.runnable
- theRunnable
to run in theSpan
.- Returns:
- the wrapped
Runnable
.
-
withSpan
- Parameters:
span
- theSpan
to be set as current.endSpan
- iftrue
the returnedRunnable
will close theSpan
.callable
- theCallable
to run in theSpan
.- Returns:
- the wrapped
Callable
.
-
setErrorStatus
-