Class ObservationTracerContext

java.lang.Object
org.apache.cxf.tracing.micrometer.ObservationTracerContext
All Implemented Interfaces:
TracerContext

public class ObservationTracerContext extends Object implements TracerContext
  • Constructor Details

    • ObservationTracerContext

      public ObservationTracerContext(io.micrometer.observation.ObservationRegistry observationRegistry)
    • ObservationTracerContext

      public ObservationTracerContext(io.micrometer.observation.ObservationRegistry observationRegistry, io.micrometer.observation.Observation continuationObservation)
  • Method Details

    • startSpan

      public ObservationScope startSpan(String description)
      Description copied from interface: TracerContext
      Starts a new span in the current thread.
      Specified by:
      startSpan in interface TracerContext
      Parameters:
      description - span description
      Returns:
      span instance object
    • continueSpan

      public <T> T continueSpan(Traceable<T> traceable) throws Exception
      Description copied from interface: TracerContext
      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.
      Specified by:
      continueSpan in interface TracerContext
      Parameters:
      traceable - traceable implementation to be executed
      Returns:
      the result of the execution
      Throws:
      Exception - any exception being thrown by the traceable implementation
    • wrap

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

      public void annotate(String key, String value)
      Description copied from interface: TracerContext
      Adds a key/value pair to the currently active span.
      Specified by:
      annotate in interface TracerContext
      Parameters:
      key - key to add
      value - value to add
    • timeline

      public void timeline(String message)
      Description copied from interface: TracerContext
      Adds a timeline to the currently active span.
      Specified by:
      timeline in interface TracerContext
      Parameters:
      message - timeline message
    • unwrap

      public <T> T unwrap(Class<T> clazz)
      Description copied from interface: TracerContext
      Returns an object of the specified type to allow access to the specific API of the tracing provider.
      Specified by:
      unwrap in interface TracerContext
      Parameters:
      clazz - - the class of the object to be returned.
      Returns:
      an instance of the specified class