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 StringEVENT_BUS_LISTENER_NAME
-
Constructor Summary
Constructors Constructor Description RequestTracingService()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSpanLog(RequestTraceSpanLog spanLog)voidbootstrapNotifierList()Configures notifiers with request tracing and starts any enabled ones.voidbootstrapRequestTracingService()Starts the request tracing serviceUnprocessedChangeEventschanged(PropertyChangeEvent[] events)Notification that @Configured objects that were injected have changedvoidcollect(fish.payara.monitoring.collect.MonitoringDataCollector collector)voidcollect(fish.payara.monitoring.collect.MonitoringWatchCollector collector)voidendTrace()voidendTrace(long timestampMillis)voidevent(EventListener.Event event)Process a Glassfish/Payara eventUUIDgetConversationID()Retrieves the current Conversation IDRequestTracingExecutionOptionsgetExecutionOptions()RequestTraceStoreInterfacegetHistoricRequestTraceStore()Returns the RequestTraceStore used for storing historical tracesRequestTraceStoreInterfacegetRequestTraceStore()Returns the RequestTraceStore used for storing tracesUUIDgetStartingTraceID()LonggetThresholdValueInNanos()booleanisRequestTracingEnabled()booleanisTraceInProgress()Returns true if a trace has started and not yet completed.static StringmetricGroupName(RequestTrace trace)voidsetTraceId(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 itRequestTraceSpanstartTrace(RequestTraceSpan span)RequestTraceSpanstartTrace(RequestTraceSpan span, long timestampMillis)RequestTraceSpanstartTrace(String traceName)Starts a new request traceRequestTraceSpanstartTrace(UUID propagatedTraceId, UUID propagatedParentId, RequestTraceSpan.SpanContextRelationshipType propagatedRelationshipType, String traceName)static StringstripPackageName(String eventName)voidtraceSpan(RequestTraceSpan requestEvent)Adds a new event to the request trace currently in progressvoidtraceSpan(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:EventListenerProcess a Glassfish/Payara event- Specified by:
eventin 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:ConfigListenerNotification that @Configured objects that were injected have changed- Specified by:
changedin 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:
collectin interfacefish.payara.monitoring.collect.MonitoringWatchSource
-
collect
public void collect(fish.payara.monitoring.collect.MonitoringDataCollector collector)
- Specified by:
collectin interfacefish.payara.monitoring.collect.MonitoringDataSource
-
metricGroupName
public static String metricGroupName(RequestTrace trace)
-
-