Class TracingContext
- java.lang.Object
-
- io.helidon.tracing.jersey.client.internal.TracingContext
-
public final class TracingContext extends Object
Context for outbound tracing. This is an internal API used from jersey integration with Tracing (currently MP tracing), to share a ThreadLocal instance.This class is mutable, to support chains of tracing filters that create additional spans and that need to update the parent span of this context.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TracingContextcreate(io.opentracing.Tracer tracer, Map<String,List<String>> inboundHeaders)Create a new tracing context with client tracing enabled.static TracingContextcreate(io.opentracing.Tracer tracer, Map<String,List<String>> inboundHeaders, boolean clientEnabled)Create a new tracing context.Map<String,List<String>>inboundHeaders()Map of headers that were received by server for an inbound call, may be used to propagate additional headers fro outbound request.io.opentracing.SpanContextparentSpan()Parent span to use for new spans created.voidparentSpan(io.opentracing.SpanContext context)Update the parent span - this may be used by filters that inject a new span between to original parent and the outbound call.booleantraceClient()Whether client (outbound) calls should be traced.io.opentracing.Tracertracer()Tracer to be used when creating new spans.
-
-
-
Method Detail
-
create
public static TracingContext create(io.opentracing.Tracer tracer, Map<String,List<String>> inboundHeaders)
Create a new tracing context with client tracing enabled.- Parameters:
tracer- tracer to useinboundHeaders- inbound header to be used for context propagation- Returns:
- a new tracing context (not associated with current thread)
- See Also:
parentSpan(SpanContext)
-
create
public static TracingContext create(io.opentracing.Tracer tracer, Map<String,List<String>> inboundHeaders, boolean clientEnabled)
Create a new tracing context.- Parameters:
tracer- tracer to useinboundHeaders- inbound header to be used for context propagationclientEnabled- whether client tracing should be enabled or not- Returns:
- a new tracing context (not associated with current thread)
- See Also:
parentSpan(SpanContext)
-
traceClient
public boolean traceClient()
Whether client (outbound) calls should be traced.- Returns:
trueif tracing is enabled for client calls
-
parentSpan
public io.opentracing.SpanContext parentSpan()
Parent span to use for new spans created.- Returns:
- span context to act as a parent for newly created spans
-
tracer
public io.opentracing.Tracer tracer()
Tracer to be used when creating new spans.- Returns:
- tracer to use
-
inboundHeaders
public Map<String,List<String>> inboundHeaders()
Map of headers that were received by server for an inbound call, may be used to propagate additional headers fro outbound request.- Returns:
- map of inbound headers
-
parentSpan
public void parentSpan(io.opentracing.SpanContext context)
Update the parent span - this may be used by filters that inject a new span between to original parent and the outbound call.- Parameters:
context- new parent span context
-
-