Class SpanManager
- java.lang.Object
-
- nl.talsmasoftware.context.opentracing.SpanManager
-
- All Implemented Interfaces:
ContextManager<Span>
- Direct Known Subclasses:
OpentracingSpanManager
public class SpanManager extends Object implements ContextManager<Span>
- Author:
- Sjoerd Talsma
-
-
Constructor Summary
Constructors Constructor Description SpanManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Context<Span>getActiveContext()Return theactive spanas aContext.Context<Span>initializeNewContext(Span span)StringtoString()
-
-
-
Method Detail
-
getActiveContext
public Context<Span> getActiveContext()
Return theactive spanas aContext.Please note: Closing this context will not close the corresponding OpenTracing scope as it is not ours to manage.
- Specified by:
getActiveContextin interfaceContextManager<Span>- Returns:
- The currently active span as a context.
-
initializeNewContext
public Context<Span> initializeNewContext(Span span)
Activates the given span.Closing the returned
Contextwill also close the correspondingScopeas it was also activated by us.
As a result of the opentracing 'rules' for scopes, every initializedContextmust be closed.
The span will not be automaticallyfinishedwhen the context is closed; this ContextManager just propagates the Span and does not concern itself with the Span's lifecycle.It is safe to close the resulting context more than once.
No scope is activated if the specified Span is
null.- Specified by:
initializeNewContextin interfaceContextManager<Span>- Parameters:
span- The span to make the active span of the current OpenTracing scope.- Returns:
- The new context that must be closed.
-
-