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 void
addEvent(RequestTraceSpan span)
Add a new event to the series being tracedvoid
addEvent(RequestTraceSpan span, long timestampMillis)
void
addSpanLog(RequestTraceSpanLog spanLog)
int
compareTo(RequestTrace requestTrace)
void
endTrace()
void
endTrace(long timestampMillis)
boolean
equals(Object o)
long
getElapsedTime()
Gets how long the trace took.Instant
getEndTime()
Gets the end time of the request trace in milliseconds since the epoch (midnight, January 1st 1970).Instant
getStartTime()
Gets the Instant when the span was started SeeInstant.now()
for how this time is generated.UUID
getTraceId()
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.int
hashCode()
boolean
isCompleted()
Returns true if a complete trace has finishedboolean
isStarted()
Returns true if a trace has started.void
setTraceId(UUID newID)
String
toString()
-
-
-
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:
null
if 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:
compareTo
in interfaceComparable<RequestTrace>
-
-