Package org.apache.camel.tracing
Class ActiveSpanManager
- java.lang.Object
-
- org.apache.camel.tracing.ActiveSpanManager
-
public final class ActiveSpanManager extends Object
Utility class for managing active spans as a stack associated with an exchange.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classActiveSpanManager.HolderSimple holder for the currently active span and an optional reference to the parent holder.
-
Field Summary
Fields Modifier and Type Field Description static StringMDC_SPAN_IDstatic StringMDC_TRACE_ID
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidactivate(org.apache.camel.Exchange exchange, SpanAdapter span)This method activates the supplied span for the supplied exchange.static voiddeactivate(org.apache.camel.Exchange exchange)This method deactivates an existing active span associated with the supplied exchange.static voidendScope(org.apache.camel.Exchange exchange)If underlying span is active, closes its scope without ending the span.static SpanAdaptergetSpan(org.apache.camel.Exchange exchange)This method returns the current active span associated with the exchange.
-
-
-
Field Detail
-
MDC_TRACE_ID
public static final String MDC_TRACE_ID
- See Also:
- Constant Field Values
-
MDC_SPAN_ID
public static final String MDC_SPAN_ID
- See Also:
- Constant Field Values
-
-
Method Detail
-
getSpan
public static SpanAdapter getSpan(org.apache.camel.Exchange exchange)
This method returns the current active span associated with the exchange.- Parameters:
exchange- The exchange- Returns:
- The current active span, or null if none exists
-
activate
public static void activate(org.apache.camel.Exchange exchange, SpanAdapter span)This method activates the supplied span for the supplied exchange. If an existing span is found for the exchange, this will be pushed onto a stack.- Parameters:
exchange- The exchangespan- The span
-
deactivate
public static void deactivate(org.apache.camel.Exchange exchange)
This method deactivates an existing active span associated with the supplied exchange. Once deactivated, if a parent span is found associated with the stack for the exchange, it will be restored as the current span for that exchange.- Parameters:
exchange- The exchange
-
endScope
public static void endScope(org.apache.camel.Exchange exchange)
If underlying span is active, closes its scope without ending the span. This methods should be called after async execution is started on the same thread on which span was activated. ExchangeAsyncStartedEvent is used to notify about it.- Parameters:
exchange- The exchange
-
-