Package 

Interface TraceScope

  • 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 interface TraceScope.Continuation

      Used 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.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.
      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.
      abstract void close() Close the activated context and allow any underlying spans to finish.
      abstract boolean isAsyncPropagating() If true, this context will propagate across async boundaries.
      abstract void setAsyncPropagation(boolean value) Enable or disable async propagation.
      • Methods inherited from class java.io.Closeable

        close
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.