Interface TraceContext

    • Method Detail

      • getId

        UUID getId()
      • isRootContext

        boolean isRootContext()
        Trace contexts can be nested. This method returns whether this is the root context.
        Returns:
        whether this is the root context
      • setExitThrowable

        void setExitThrowable​(Throwable exitThrowable)
        Setting a throwable indicates that the trace context hasn't exited regularly. As a consequence, durations can't necessarily be compared to other traces.
        Parameters:
        exitThrowable - the throwable that exited the trace
      • startTrace

        default ActiveTrace startTrace​(String label)
        Starts a new sub-trace as a direct child of this trace context. Ends any currently active trace of this context, if there is one.

        This method returns an ActiveTrace that can be used in a try-with-resource.

        Parameters:
        label - the label to use for this trace
        Returns:
        an ActiveTrace that can be used in a try-with-resource
      • startTrace

        ActiveTrace startTrace​(String label,
                               Object... labelFormatArgs)
        Starts a new sub-trace within this trace context. Ends the currently active trace of this trace context, if there is one.

        v *

        Parameters:
        label - the label to use for this trace; may contain placeholders
        labelFormatArgs - the format arguments for the placeholders in the label
        Returns:
        an ActiveTrace that can be used in a try-with-resource
      • getActiveTrace

        ActiveTrace getActiveTrace()
        Returns the deepest currently active trace of the current context or a no-op dummy if none is available.
        Returns:
        the deepest currently active trace of the current context or a no-op dummy if none is available.