Package fish.payara.opentracing
Class PropagationHelper
- java.lang.Object
-
- fish.payara.opentracing.PropagationHelper
-
- All Implemented Interfaces:
io.opentelemetry.context.Scope
,AutoCloseable
public class PropagationHelper extends Object implements io.opentelemetry.context.Scope
Helper for the most usual propagation scenarios.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
PropagationHelper.LocalScope
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
end()
End the span successfully.void
end(Throwable error)
End the span with an error.io.opentelemetry.context.Scope
localScope()
Install span and context as current for partial execution.io.opentelemetry.api.trace.Span
span()
static PropagationHelper
start(io.opentelemetry.api.trace.Span span, io.opentelemetry.context.Context spanContext)
The most usual constellation where we wrap context and span execution synchronously.static PropagationHelper
startMultiThreaded(io.opentelemetry.api.trace.Span span, io.opentelemetry.context.Context spanContext)
Start initial processing of a request that will continue processing in multiple threads.
-
-
-
Method Detail
-
start
public static PropagationHelper start(io.opentelemetry.api.trace.Span span, io.opentelemetry.context.Context spanContext)
The most usual constellation where we wrap context and span execution synchronously. Span and Context gets installed and then finished upon closing of returnedPropagationHelper
, as well as Span gets ended with OK status at the end.- Parameters:
span
-spanContext
-- Returns:
-
startMultiThreaded
public static PropagationHelper startMultiThreaded(io.opentelemetry.api.trace.Span span, io.opentelemetry.context.Context spanContext)
Start initial processing of a request that will continue processing in multiple threads. Span and Context gets- Parameters:
span
-spanContext
-- Returns:
-
localScope
public io.opentelemetry.context.Scope localScope()
Install span and context as current for partial execution. Span is not finished upon closing this scope and it needs to be ended explicitly viaend()
method.- Returns:
- Scope to use in try-with-resources
-
span
public io.opentelemetry.api.trace.Span span()
-
end
public void end()
End the span successfully. Should not be used in single-threaded scenario.
-
end
public void end(Throwable error)
End the span with an error. Can be used in both single and multi-threaded scenarios. Ending span twice in single threaded scenario is prevented.- Parameters:
error
-
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceio.opentelemetry.context.Scope
-
-