Package org.springframework.cloud.sleuth
Interface CurrentTraceContext
public interface CurrentTraceContext
This API was heavily influenced by Brave. Parts of its documentation were taken
directly from Brave.
This makes a given span the current span by placing it in scope (usually but not always
a thread local scope).
- Since:
- 3.0.0
- Author:
- OpenZipkin Brave Authors, Marcin Grzejszczak
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptioncontext()maybeScope(TraceContext context) LikenewScope(TraceContext), except returns a noop scope if the given context is already in scope.newScope(TraceContext context) Sets the current span in scope until the returned object is closed.Wraps a task in a trace representation.<C> Callable<C>Wraps a task in a trace representation.Wraps an executor in a trace representation.wrap(ExecutorService delegate) Wraps an executor service in a trace representation.
-
Method Details
-
context
- Returns:
- current
TraceContextornullif not set.
-
newScope
Sets the current span in scope until the returned object is closed. It is a programming error to drop or never close the result. Using try-with-resources is preferred for this reason.- Parameters:
context- span to place into scope ornullto clear the scope- Returns:
- the scope with the span set
-
maybeScope
LikenewScope(TraceContext), except returns a noop scope if the given context is already in scope.- Parameters:
context- span to place into scope ornullto clear the scope- Returns:
- the scope with the span set
-
wrap
Wraps a task in a trace representation.- Type Parameters:
C- task return type- Parameters:
task- task to wrap- Returns:
- wrapped task
-
wrap
Wraps a task in a trace representation.- Parameters:
task- task to wrap- Returns:
- wrapped task
-
wrap
Wraps an executor in a trace representation.- Parameters:
delegate- executor to wrap- Returns:
- wrapped executor
-
wrap
Wraps an executor service in a trace representation.- Parameters:
delegate- executor service to wrap- Returns:
- wrapped executor service
-