Package jenkins.metrics.api
Class QueueItemMetricsEvent
java.lang.Object
jenkins.metrics.api.QueueItemMetricsEvent
Holds the metrics about a queue item.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The state of the item when this metrics event was created. -
Constructor Summary
ConstructorsConstructorDescriptionQueueItemMetricsEvent
(Queue.Item item, Label assignedLabel, QueueItemMetricsEvent.State state, Run<?, ?> run, Queue.Executable executable, List<Set<LabelAtom>> consumedLabelAtoms, Long queuingTotalMillis, Long queuingWaitingMillis, Long queuingBlockedMillis, Long queuingBuildableMillis, Long executingMillis, Integer executorCount) -
Method Summary
Modifier and TypeMethodDescriptionstatic int
SortsQueueItemMetricsEvent
s bygetEventTick()
.static int
SortsQueueItemMetricsEvent
s by the orderQueue.Item.getId()
.boolean
Returns theQueue.Item.getAssignedLabel()
at the time of the event ornull
if the item was not assigned to a label.Returns theNode.getAssignedLabels()
of all the executor slots occupied by this task, if the task has been started.long
Returns the currentSystem.currentTimeMillis()
comparable time when this event occurred.long
Returns theSystem.nanoTime()
comparable tick when this event occurred.Returns theQueue.Executable
created from theQueue.Item
belongs.If theQueue.Executable
has finished executing, returns the number of milliseconds the item spent executing.If theQueue.Executable
has started executing, returns the number of executors being used.long
getId()
Returns theQueue.Item.getId()
.getItem()
Returns theQueue.Item
.If theQueue.Item
has left the queue, returns the number of milliseconds the item was on the queue in the blocked state.If theQueue.Item
has left the queue, returns the number of milliseconds the item was on the queue in the buildable state.If theQueue.Item
has left the queue, returns the number of milliseconds the item was on the queue.If theQueue.Item
has left the queue, returns the number of milliseconds the item was on the queue in the waiting state.getRun()
Returns theRun
to which theQueue.Item
belongs.getState()
Returns the state of theQueue.Item
when the event occurred.int
hashCode()
toString()
-
Constructor Details
-
QueueItemMetricsEvent
public QueueItemMetricsEvent(@NonNull Queue.Item item, @CheckForNull Label assignedLabel, @NonNull QueueItemMetricsEvent.State state, @CheckForNull Run<?, ?> run, @CheckForNull Queue.Executable executable, @CheckForNull List<Set<LabelAtom>> consumedLabelAtoms, @CheckForNull Long queuingTotalMillis, @CheckForNull Long queuingWaitingMillis, @CheckForNull Long queuingBlockedMillis, @CheckForNull Long queuingBuildableMillis, @CheckForNull Long executingMillis, @CheckForNull Integer executorCount)
-
-
Method Details
-
compareEventSequence
SortsQueueItemMetricsEvent
s bygetEventTick()
.- Parameters:
x
- the firstQueueItemMetricsEvent
to comparey
- the secondQueueItemMetricsEvent
to compare- Returns:
- the value
0
if both events happend at the same time; a value less than0
ifx
happened beforey
; and a value greater than0
ify
happened beforex
-
compareQueueSequence
SortsQueueItemMetricsEvent
s by the orderQueue.Item.getId()
.- Parameters:
x
- the firstQueueItemMetricsEvent
to comparey
- the secondQueueItemMetricsEvent
to compare- Returns:
- the value
0
if both events happend at the same time; a value less than0
ifx
was enqueued beforey
; and a value greater than0
ify
was enqueued beforex
-
getEventTick
public long getEventTick()Returns theSystem.nanoTime()
comparable tick when this event occurred.- Returns:
- the
System.nanoTime()
comparable tick when this event occurred.
-
getEventMillis
public long getEventMillis()Returns the currentSystem.currentTimeMillis()
comparable time when this event occurred. IMPORTANT if the system clock has changed between when the event occurred and now, this function will return the time comparable to now, not the time comparable to the value ofSystem.currentTimeMillis()
at the time of the event. ComparegetEventTick()
withSystem.nanoTime()
if you need to measure the time since the event.- Returns:
- the current
System.currentTimeMillis()
comparable time when this event occurred.
-
getId
public long getId()Returns theQueue.Item.getId()
.- Returns:
- the
Queue.Item.getId()
.
-
getState
Returns the state of theQueue.Item
when the event occurred.- Returns:
- the state of the
Queue.Item
when the event occurred.
-
getItem
Returns theQueue.Item
.- Returns:
- the
Queue.Item
.
-
getAssignedLabel
Returns theQueue.Item.getAssignedLabel()
at the time of the event ornull
if the item was not assigned to a label.- Returns:
- the
Queue.Item.getAssignedLabel()
at the time of the event ornull
if the item was not assigned to a label.
-
getRun
Returns theRun
to which theQueue.Item
belongs.- Returns:
- the
Run
to which theQueue.Item
belongs, if present.
-
getExecutable
Returns theQueue.Executable
created from theQueue.Item
belongs.- Returns:
- the
Queue.Executable
created from theQueue.Item
belongs, if present.
-
getConsumedLabelAtoms
Returns theNode.getAssignedLabels()
of all the executor slots occupied by this task, if the task has been started.- Returns:
- the
Node.getAssignedLabels()
of all the executor slots occupied by this task, if the task has been started, otherwiseOptional.empty()
.
-
getQueuingTotalMillis
If theQueue.Item
has left the queue, returns the number of milliseconds the item was on the queue.- Returns:
- if the
Queue.Item
has left the queue, returns the number of milliseconds the item was on the queue, otherwiseOptional.empty()
.
-
getQueuingWaitingMillis
If theQueue.Item
has left the queue, returns the number of milliseconds the item was on the queue in the waiting state.- Returns:
- if the
Queue.Item
has left the queue, returns the number of milliseconds the item was on the queue in the waiting state, otherwiseOptional.empty()
.
-
getQueuingBlockedMillis
If theQueue.Item
has left the queue, returns the number of milliseconds the item was on the queue in the blocked state.- Returns:
- if the
Queue.Item
has left the queue, returns the number of milliseconds the item was on the queue in the blocked state, otherwiseOptional.empty()
.
-
getQueuingBuildableMillis
If theQueue.Item
has left the queue, returns the number of milliseconds the item was on the queue in the buildable state.- Returns:
- if the
Queue.Item
has left the queue, returns the number of milliseconds the item was on the queue in the buildable state, otherwiseOptional.empty()
.
-
getExecutingMillis
If theQueue.Executable
has finished executing, returns the number of milliseconds the item spent executing.- Returns:
- if the
Queue.Executable
has finished executing, returns the number of milliseconds the item spent executing, otherwiseOptional.empty()
.
-
getExecutorCount
If theQueue.Executable
has started executing, returns the number of executors being used.- Returns:
- if the
Queue.Executable
has started executing, returns the number of executors being used, otherwiseOptional.empty()
.
-
equals
-
hashCode
public int hashCode() -
toString
-