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 enumThe 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 intSortsQueueItemMetricsEvents bygetEventTick().static intSortsQueueItemMetricsEvents by the orderQueue.Item.getId().booleanReturns theQueue.Item.getAssignedLabel()at the time of the event ornullif 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.longReturns the currentSystem.currentTimeMillis()comparable time when this event occurred.longReturns theSystem.nanoTime()comparable tick when this event occurred.Returns theQueue.Executablecreated from theQueue.Itembelongs.If theQueue.Executablehas finished executing, returns the number of milliseconds the item spent executing.If theQueue.Executablehas started executing, returns the number of executors being used.longgetId()Returns theQueue.Item.getId().getItem()Returns theQueue.Item.If theQueue.Itemhas left the queue, returns the number of milliseconds the item was on the queue in the blocked state.If theQueue.Itemhas left the queue, returns the number of milliseconds the item was on the queue in the buildable state.If theQueue.Itemhas left the queue, returns the number of milliseconds the item was on the queue.If theQueue.Itemhas left the queue, returns the number of milliseconds the item was on the queue in the waiting state.getRun()Returns theRunto which theQueue.Itembelongs.getState()Returns the state of theQueue.Itemwhen the event occurred.inthashCode()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
SortsQueueItemMetricsEvents bygetEventTick().- Parameters:
x- the firstQueueItemMetricsEventto comparey- the secondQueueItemMetricsEventto compare- Returns:
- the value
0if both events happend at the same time; a value less than0ifxhappened beforey; and a value greater than0ifyhappened beforex
-
compareQueueSequence
SortsQueueItemMetricsEvents by the orderQueue.Item.getId().- Parameters:
x- the firstQueueItemMetricsEventto comparey- the secondQueueItemMetricsEventto compare- Returns:
- the value
0if both events happend at the same time; a value less than0ifxwas enqueued beforey; and a value greater than0ifywas 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.Itemwhen the event occurred.- Returns:
- the state of the
Queue.Itemwhen the event occurred.
-
getItem
Returns theQueue.Item.- Returns:
- the
Queue.Item.
-
getAssignedLabel
Returns theQueue.Item.getAssignedLabel()at the time of the event ornullif the item was not assigned to a label.- Returns:
- the
Queue.Item.getAssignedLabel()at the time of the event ornullif the item was not assigned to a label.
-
getRun
Returns theRunto which theQueue.Itembelongs.- Returns:
- the
Runto which theQueue.Itembelongs, if present.
-
getExecutable
Returns theQueue.Executablecreated from theQueue.Itembelongs.- Returns:
- the
Queue.Executablecreated from theQueue.Itembelongs, 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.Itemhas left the queue, returns the number of milliseconds the item was on the queue.- Returns:
- if the
Queue.Itemhas left the queue, returns the number of milliseconds the item was on the queue, otherwiseOptional.empty().
-
getQueuingWaitingMillis
If theQueue.Itemhas left the queue, returns the number of milliseconds the item was on the queue in the waiting state.- Returns:
- if the
Queue.Itemhas left the queue, returns the number of milliseconds the item was on the queue in the waiting state, otherwiseOptional.empty().
-
getQueuingBlockedMillis
If theQueue.Itemhas left the queue, returns the number of milliseconds the item was on the queue in the blocked state.- Returns:
- if the
Queue.Itemhas left the queue, returns the number of milliseconds the item was on the queue in the blocked state, otherwiseOptional.empty().
-
getQueuingBuildableMillis
If theQueue.Itemhas left the queue, returns the number of milliseconds the item was on the queue in the buildable state.- Returns:
- if the
Queue.Itemhas left the queue, returns the number of milliseconds the item was on the queue in the buildable state, otherwiseOptional.empty().
-
getExecutingMillis
If theQueue.Executablehas finished executing, returns the number of milliseconds the item spent executing.- Returns:
- if the
Queue.Executablehas finished executing, returns the number of milliseconds the item spent executing, otherwiseOptional.empty().
-
getExecutorCount
If theQueue.Executablehas started executing, returns the number of executors being used.- Returns:
- if the
Queue.Executablehas started executing, returns the number of executors being used, otherwiseOptional.empty().
-
equals
-
hashCode
public int hashCode() -
toString
-