Class OpenTracingContext
- java.lang.Object
-
- org.apache.cxf.tracing.opentracing.OpenTracingContext
-
- All Implemented Interfaces:
TracerContext
public class OpenTracingContext extends Object implements TracerContext
-
-
Constructor Summary
Constructors Constructor Description OpenTracingContext(io.opentracing.Tracer tracer)OpenTracingContext(io.opentracing.Tracer tracer, io.opentracing.Span continuation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidannotate(String key, String value)Adds a key/value pair to the currently active span.<T> TcontinueSpan(Traceable<T> traceable)Picks up an currently detached span from another thread.io.opentracing.ScopestartSpan(String description)Starts a new span in the current thread.voidtimeline(String message)Adds a timeline to the currently active span.<T> Tunwrap(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 Detail
-
startSpan
public io.opentracing.Scope startSpan(String description)
Description copied from interface:TracerContextStarts a new span in the current thread.- Specified by:
startSpanin interfaceTracerContext- Parameters:
description- span description- Returns:
- span instance object
-
continueSpan
public <T> T continueSpan(Traceable<T> traceable) throws Exception
Description copied from interface:TracerContextPicks 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:
continueSpanin interfaceTracerContext- 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:TracerContextWraps the traceable into a new span, preserving the current span as a parent.- Specified by:
wrapin interfaceTracerContext- Parameters:
description- span descriptiontraceable- 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:TracerContextAdds a key/value pair to the currently active span.- Specified by:
annotatein interfaceTracerContext- Parameters:
key- key to addvalue- value to add
-
timeline
public void timeline(String message)
Description copied from interface:TracerContextAdds a timeline to the currently active span.- Specified by:
timelinein interfaceTracerContext- Parameters:
message- timeline message
-
unwrap
public <T> T unwrap(Class<T> clazz)
Description copied from interface:TracerContextReturns an object of the specified type to allow access to the specific API of the tracing provider.- Specified by:
unwrapin interfaceTracerContext- Parameters:
clazz- - the class of the object to be returned.- Returns:
- an instance of the specified class
-
-