Interface TracerContext


public interface TracerContext
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    annotate(String key, String value)
    Adds a key/value pair to the currently active span.
    <T> T
    continueSpan(Traceable<T> traceable)
    Picks up an currently detached span from another thread.
    <T> T
    startSpan(String description)
    Starts a new span in the current thread.
    void
    timeline(String message)
    Adds a timeline to the currently active span.
    default <T> T
    unwrap(Class<T> clazz)
    Returns an object of the specified type to allow access to the specific API of the tracing provider.
    <T> Callable<T>
    wrap(String description, Traceable<T> traceable)
    Wraps the traceable into a new span, preserving the current span as a parent.
  • Method Details

    • continueSpan

      <T> T continueSpan(Traceable<T> traceable) throws Exception
      Picks up an currently detached span from another thread. This method is intended to be used in the context of JAX-RS asynchronous invocations, where request and response are effectively executed by different threads.
      Parameters:
      traceable - traceable implementation to be executed
      Returns:
      the result of the execution
      Throws:
      Exception - any exception being thrown by the traceable implementation
    • startSpan

      <T> T startSpan(String description)
      Starts a new span in the current thread.
      Parameters:
      description - span description
      Returns:
      span instance object
    • wrap

      <T> Callable<T> wrap(String description, Traceable<T> traceable)
      Wraps the traceable into a new span, preserving the current span as a parent.
      Parameters:
      description - span description
      traceable - traceable implementation to be wrapped
      Returns:
      callable to be executed (in current thread or any other thread pool)
    • annotate

      void annotate(String key, String value)
      Adds a key/value pair to the currently active span.
      Parameters:
      key - key to add
      value - value to add
    • timeline

      void timeline(String message)
      Adds a timeline to the currently active span.
      Parameters:
      message - timeline message
    • unwrap

      default <T> T unwrap(Class<T> clazz)
      Returns an object of the specified type to allow access to the specific API of the tracing provider.
      Parameters:
      clazz - - the class of the object to be returned.
      Returns:
      an instance of the specified class