Class RequestTracingService
- java.lang.Object
-
- fish.payara.nucleus.requesttracing.RequestTracingService
-
- All Implemented Interfaces:
fish.payara.monitoring.collect.MonitoringDataSource
,fish.payara.monitoring.collect.MonitoringWatchSource
,EventListener
,ConfigListener
@Service(name="requesttracing-service") @RunLevel(10) public class RequestTracingService extends Object implements EventListener, ConfigListener, fish.payara.monitoring.collect.MonitoringDataSource, fish.payara.monitoring.collect.MonitoringWatchSource
Main service class that provides methods used by interceptors for tracing requests.- Since:
- 4.1.1.163
- Author:
- mertcaliskan
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.glassfish.api.event.EventListener
EventListener.Event<T>
-
-
Field Summary
Fields Modifier and Type Field Description static String
EVENT_BUS_LISTENER_NAME
-
Constructor Summary
Constructors Constructor Description RequestTracingService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSpanLog(RequestTraceSpanLog spanLog)
void
bootstrapNotifierList()
Configures notifiers with request tracing and starts any enabled ones.void
bootstrapRequestTracingService()
Starts the request tracing serviceUnprocessedChangeEvents
changed(PropertyChangeEvent[] events)
Notification that @Configured objects that were injected have changedvoid
collect(fish.payara.monitoring.collect.MonitoringDataCollector collector)
void
collect(fish.payara.monitoring.collect.MonitoringWatchCollector collector)
void
endTrace()
void
endTrace(long timestampMillis)
void
event(EventListener.Event event)
Process a Glassfish/Payara eventUUID
getConversationID()
Retrieves the current Conversation IDRequestTracingExecutionOptions
getExecutionOptions()
RequestTraceStoreInterface
getHistoricRequestTraceStore()
Returns the RequestTraceStore used for storing historical tracesRequestTraceStoreInterface
getRequestTraceStore()
Returns the RequestTraceStore used for storing tracesUUID
getStartingTraceID()
Long
getThresholdValueInNanos()
boolean
isRequestTracingEnabled()
boolean
isTraceInProgress()
Returns true if a trace has started and not yet completed.static String
metricGroupName(RequestTrace trace)
void
setTraceId(UUID newID)
Reset the conversation ID This is especially useful for trace propagation across threads when the event tracer can receive the conversation ID propagated to itRequestTraceSpan
startTrace(RequestTraceSpan span)
RequestTraceSpan
startTrace(RequestTraceSpan span, long timestampMillis)
RequestTraceSpan
startTrace(String traceName)
Starts a new request traceRequestTraceSpan
startTrace(UUID propagatedTraceId, UUID propagatedParentId, RequestTraceSpan.SpanContextRelationshipType propagatedRelationshipType, String traceName)
static String
stripPackageName(String eventName)
void
traceSpan(RequestTraceSpan requestEvent)
Adds a new event to the request trace currently in progressvoid
traceSpan(RequestTraceSpan requestEvent, long timestampMillis)
-
-
-
Field Detail
-
EVENT_BUS_LISTENER_NAME
public static final String EVENT_BUS_LISTENER_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
event
public void event(EventListener.Event event)
Description copied from interface:EventListener
Process a Glassfish/Payara event- Specified by:
event
in interfaceEventListener
-
bootstrapRequestTracingService
public void bootstrapRequestTracingService()
Starts the request tracing service- Since:
- 4.1.1.171
-
bootstrapNotifierList
public void bootstrapNotifierList()
Configures notifiers with request tracing and starts any enabled ones. If no options are set then the log notifier is automatically turned on.- Since:
- 4.1.2.173
-
getConversationID
public UUID getConversationID()
Retrieves the current Conversation ID- Returns:
-
getStartingTraceID
public UUID getStartingTraceID()
-
setTraceId
public void setTraceId(UUID newID)
Reset the conversation ID This is especially useful for trace propagation across threads when the event tracer can receive the conversation ID propagated to it- Parameters:
newID
-
-
isTraceInProgress
public boolean isTraceInProgress()
Returns true if a trace has started and not yet completed. NOTE: This only applies to traces started using the request tracing service; traces started using OpenTracing *MAY* not be picked up by this (for example, if you're using the OpenTracing MockTracer instead of the in-built one).- Returns:
-
startTrace
public RequestTraceSpan startTrace(String traceName)
Starts a new request trace- Returns:
- a unique identifier for the request trace
-
startTrace
public RequestTraceSpan startTrace(RequestTraceSpan span)
-
startTrace
public RequestTraceSpan startTrace(RequestTraceSpan span, long timestampMillis)
-
startTrace
public RequestTraceSpan startTrace(UUID propagatedTraceId, UUID propagatedParentId, RequestTraceSpan.SpanContextRelationshipType propagatedRelationshipType, String traceName)
-
traceSpan
public void traceSpan(RequestTraceSpan requestEvent)
Adds a new event to the request trace currently in progress- Parameters:
requestEvent
-
-
traceSpan
public void traceSpan(RequestTraceSpan requestEvent, long timestampMillis)
-
endTrace
public void endTrace()
-
endTrace
public void endTrace(long timestampMillis)
-
addSpanLog
public void addSpanLog(RequestTraceSpanLog spanLog)
-
getThresholdValueInNanos
public Long getThresholdValueInNanos()
- Returns:
- Since:
- 4.1.1.164
-
isRequestTracingEnabled
public boolean isRequestTracingEnabled()
-
getExecutionOptions
public RequestTracingExecutionOptions getExecutionOptions()
-
changed
public UnprocessedChangeEvents changed(PropertyChangeEvent[] events)
Description copied from interface:ConfigListener
Notification that @Configured objects that were injected have changed- Specified by:
changed
in interfaceConfigListener
- Parameters:
events
- list of changes- Returns:
- the list of unprocessed events (requiring a restart) or null if all reconfiguration was processed successfully
-
getHistoricRequestTraceStore
public RequestTraceStoreInterface getHistoricRequestTraceStore()
Returns the RequestTraceStore used for storing historical traces- Returns:
-
getRequestTraceStore
public RequestTraceStoreInterface getRequestTraceStore()
Returns the RequestTraceStore used for storing traces- Returns:
-
collect
public void collect(fish.payara.monitoring.collect.MonitoringWatchCollector collector)
- Specified by:
collect
in interfacefish.payara.monitoring.collect.MonitoringWatchSource
-
collect
public void collect(fish.payara.monitoring.collect.MonitoringDataCollector collector)
- Specified by:
collect
in interfacefish.payara.monitoring.collect.MonitoringDataSource
-
metricGroupName
public static String metricGroupName(RequestTrace trace)
-
-