Interface TraceScope.Continuation

All Known Implementing Classes:
NoopTraceScope.NoopContinuation
Enclosing interface:
TraceScope

public static interface TraceScope.Continuation
Used to pass async context between workers. A trace will not be reported until all spans and continuations are resolved. You must call activate (and close on the returned scope) or cancel on each continuation to avoid discarding traces.
  • Method Summary

    Modifier and Type
    Method
    Description
    Activate the continuation.
    void
    Allow trace to stop waiting on this continuation for reporting.
    Prevent the trace attached to this scope from reporting until the continuation is explicitly cancelled.
  • Method Details

    • hold

      Prevent the trace attached to this scope from reporting until the continuation is explicitly cancelled. You must call cancel() at some point to avoid discarding traces.

      Use this when you want to let multiple threads activate the continuation concurrently and close their scopes without fear of prematurely closing the related span.

    • activate

      TraceScope activate()
      Activate the continuation.

      Should be called on the child thread.

      Consider calling this in a try-with-resources initialization block to ensure the returned scope is closed properly.

    • cancel

      void cancel()
      Allow trace to stop waiting on this continuation for reporting.