Add stage_pause_duration metric#191
Conversation
| long pauseDuration = getPauseDuration(startNode); | ||
|
|
||
| client.gauge("jenkins.job.stage_duration", getTime(startNode, endNode), hostname, tags); | ||
| client.gauge("jenkins.job.stage_pause_duration", pauseDuration, hostname, tags); |
There was a problem hiding this comment.
Let's make sure to update the metadata.csv for that metric so that it is displayed as ms
|
|
||
| Iterator<FlowNode> it = walker.iterator(); | ||
|
|
||
| // Iterate on the execution nodes to include pause duration of sub-stages |
There was a problem hiding this comment.
Let's add a small comment to explain that part.
QQ: The FlowGraphWalker is instantiated while the pipeline is running (because called in onNewHead).
Are we sure this is safe to iterate through all nodes and are we sure we get the correct pause value?
There was a problem hiding this comment.
QQ: The FlowGraphWalker is instantiated while the pipeline is running (because called in onNewHead).
Are we sure this is safe to iterate through all nodes and are we sure we get the correct pause value?
Even if the pipeline is running, nodes for which startNode is a parent are finished at this point. I added a condition to make sure we consider non-active nodes.
|
Great job with this PR 👏 |
What does this PR do?
Add
jenkins.job.stage_pause_durationmetric. The value is the pause duration of a stage in milliseconds.A pause can be a stage waiting for a user input.
Description of the Change
Each time
onNewHeadis called, it goes over the execution betweenstartNodeandendNode, to sum the pause durations of all the subnodes.It uses the
FlowNodeExtwrapper to get the pause duration of a nodeAlternate Designs
Possible Drawbacks
Verification Process
Additional Notes
The loops in
getPauseDurationare needed to get the sub-node pause durations, in order to have an accuratejenkins.job.stage_pause_durationmetric value for nested stages.Release Notes
Review checklist (to be filled by reviewers)
changelog/label attached. If applicable it should have thebackward-incompatiblelabel attached.do-not-merge/label attached.kind/andseverity/labels attached at least.