Class OpenTracingContext

    • Constructor Detail

      • OpenTracingContext

        public OpenTracingContext​(io.opentracing.Tracer tracer)
      • OpenTracingContext

        public OpenTracingContext​(io.opentracing.Tracer tracer,
                                  io.opentracing.Span continuation)
    • Method Detail

      • startSpan

        public io.opentracing.Scope 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