-
- All Implemented Interfaces:
-
java.io.Closeable,java.lang.AutoCloseable
public interface TraceScope implements Closeable
An object which can propagate a datadog trace across multiple threads.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceTraceScope.ContinuationUsed to pass async context between workers. A trace will not be reported until all spans andcontinuations are resolved. You must call activate (and close on the returned scope) or cancelon each continuation to avoid discarding traces.
-
Method Summary
Modifier and Type Method Description abstract TraceScope.Continuationcapture()Prevent the trace attached to this TraceScope from reporting until the returned Continuation iseither activated (and the returned scope is closed), or canceled. abstract TraceScope.ContinuationcaptureConcurrent()Prevent the trace attached to this TraceScope from reporting until the returned Continuation iseither activated (and the returned scope is closed), or canceled. abstract voidclose()Close the activated context and allow any underlying spans to finish. abstract booleanisAsyncPropagating()If true, this context will propagate across async boundaries. abstract voidsetAsyncPropagation(boolean value)Enable or disable async propagation. -
-
Method Detail
-
capture
abstract TraceScope.Continuation capture()
Prevent the trace attached to this TraceScope from reporting until the returned Continuation iseither activated (and the returned scope is closed), or canceled.
Should be called on the parent thread.
-
captureConcurrent
abstract TraceScope.Continuation captureConcurrent()
Prevent the trace attached to this TraceScope from reporting until the returned Continuation iseither activated (and the returned scope is closed), or canceled.
Should be called on the parent thread.
If the returned Continuation is activated, it needs to be canceled in addition tothe returned TraceScope being closed. This is to allow multiple concurrent threads thatactivate the continuation to race in a safe way, and close the scopes without fear of closingthe related
{@code Span}prematurely.
-
close
abstract void close()
Close the activated context and allow any underlying spans to finish.
-
isAsyncPropagating
abstract boolean isAsyncPropagating()
If true, this context will propagate across async boundaries.
-
setAsyncPropagation
abstract void setAsyncPropagation(boolean value)
Enable or disable async propagation. Async propagation is initially set to false.
- Parameters:
value- The new propagation value.
-
-
-
-