Class RequestTrace
- java.lang.Object
-
- fish.payara.notification.requesttracing.RequestTrace
-
- All Implemented Interfaces:
Serializable,Comparable<RequestTrace>
public class RequestTrace extends Object implements Serializable, Comparable<RequestTrace>
Class representing a full Request Trace. Stored in a ThreadLocal in the Request Event Store- Author:
- steve
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RequestTrace()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEvent(RequestTraceSpan span)Add a new event to the series being tracedvoidaddEvent(RequestTraceSpan span, long timestampMillis)voidaddSpanLog(RequestTraceSpanLog spanLog)intcompareTo(RequestTrace requestTrace)voidendTrace()voidendTrace(long timestampMillis)booleanequals(Object o)longgetElapsedTime()Gets how long the trace took.InstantgetEndTime()Gets the end time of the request trace in milliseconds since the epoch (midnight, January 1st 1970).InstantgetStartTime()Gets the Instant when the span was started SeeInstant.now()for how this time is generated.UUIDgetTraceId()Returns a unique identifier for the trace, which comes from the first event.LinkedList<RequestTraceSpan>getTraceSpans()Returns a list of all the events that make up the trace.inthashCode()booleanisCompleted()Returns true if a complete trace has finishedbooleanisStarted()Returns true if a trace has started.voidsetTraceId(UUID newID)StringtoString()
-
-
-
Method Detail
-
addEvent
public void addEvent(RequestTraceSpan span)
Add a new event to the series being traced- Parameters:
span-
-
addEvent
public void addEvent(RequestTraceSpan span, long timestampMillis)
-
endTrace
public void endTrace()
-
endTrace
public void endTrace(long timestampMillis)
-
getElapsedTime
public long getElapsedTime()
Gets how long the trace took. If the trace has not finished then this will be 0.- Returns:
- Time for trace in milliseconds
-
isStarted
public boolean isStarted()
Returns true if a trace has started. This will return true even if the trace has completed.- Returns:
-
getTraceSpans
public LinkedList<RequestTraceSpan> getTraceSpans()
Returns a list of all the events that make up the trace.- Returns:
- A list containing all of the Spans that constitute this trace.
-
getStartTime
public Instant getStartTime()
Gets the Instant when the span was started SeeInstant.now()for how this time is generated.- Returns:
- The Instant for when this span was started.
-
getEndTime
public Instant getEndTime()
Gets the end time of the request trace in milliseconds since the epoch (midnight, January 1st 1970).This value is 0 until the request trace in finished.
- Returns:
-
getTraceId
public UUID getTraceId()
Returns a unique identifier for the trace, which comes from the first event.- Returns:
nullif no trace started
-
setTraceId
public void setTraceId(UUID newID)
-
isCompleted
public boolean isCompleted()
Returns true if a complete trace has finished- Returns:
-
addSpanLog
public void addSpanLog(RequestTraceSpanLog spanLog)
-
compareTo
public int compareTo(RequestTrace requestTrace)
- Specified by:
compareToin interfaceComparable<RequestTrace>
-
-