Skip to content

Add ci.queue_time for pipeline/stage/job traces#159

Merged
drodriguezhdez merged 10 commits into
masterfrom
drodriguezhdez/stage_queue_time
Dec 15, 2020
Merged

Add ci.queue_time for pipeline/stage/job traces#159
drodriguezhdez merged 10 commits into
masterfrom
drodriguezhdez/stage_queue_time

Conversation

@drodriguezhdez

Copy link
Copy Markdown
Collaborator

Requirements for Contributing to this repository

  • Fill out the template below. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • The pull request must only fix one issue at the time.
  • The pull request must update the test suite to demonstrate the changed functionality.
  • After you create the pull request, all status checks must be pass before a maintainer reviews your contribution. For more details, please see CONTRIBUTING.

What does this PR do?

Add ci.queue_time for pipeline/stage/job traces in Jenkins Build/Pipelines.

Description of the Change

Alternate Designs

Possible Drawbacks

Verification Process

Additional Notes

Release Notes

Review checklist (to be filled by reviewers)

  • Feature or bug fix MUST have appropriate tests (unit, integration, etc...)
  • PR title must be written as a CHANGELOG entry (see why)
  • Files changes must correspond to the primary purpose of the PR as described in the title (small unrelated changes should have their own PR)
  • PR must have one changelog/ label attached. If applicable it should have the backward-incompatible label attached.
  • PR should not have do-not-merge/ label attached.
  • If Applicable, issue must have kind/ and severity/ labels attached at least.

@drodriguezhdez drodriguezhdez added the changelog/Added Added features results into a minor version bump label Nov 26, 2020
@drodriguezhdez
drodriguezhdez marked this pull request as draft November 30, 2020 07:50
@drodriguezhdez
drodriguezhdez marked this pull request as ready for review December 2, 2020 12:57
Comment on lines +117 to +121
// As the agent information will be stored in the Allocate node children
// we need to propagate the information to the indexed span.
for(final BuildPipelineNode parentIter : node.getParents()) {
parentIter.setPropagatedSecondsInQueue(node.getSecondsInQueue());
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't follow that bit. We're propagating the time in queue of the curent node to each of its parent and we only do that to make the retrieval of that information easier later on, right?

What if a parent has multiple children and they all update the propagatedSecondsInQueue? What about the time the parents themselves are in queue? There might be something I don't follow to understand fully this PR

@drodriguezhdez drodriguezhdez Dec 15, 2020

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it might cause unexpected behaviour. I inverted the propagation approach, checking when the current node is the initial or stage and checking if its child is an Allocate node node. Only in this case, we propagate the queue time.

This is needed because in Jenkins the queue time is calculated in this kind of nodes (Allocate node), and not in the concrete Stage/ Initial node. We need to propagate all information to the correct nodes that will be indexed in the backend.

@FlorianVeaux FlorianVeaux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, there's a core concept of that PR that I'm not sure to follow though. Would you mind giving more details about what it means for a node to be "in queue", why we're propagating that to parents etc.?

@drodriguezhdez

drodriguezhdez commented Dec 15, 2020

Copy link
Copy Markdown
Collaborator Author

Sure. We consider that an item enters "in queue" when the item is "buildable" but it is waiting for some node to be scheduled to be built.

For Jenkins Build, the solution is straightforward cause there is an API to obtain the queue time directly. Unfortunately for Jenkins Pipelines, the queue time is calculated under the nodes which name is the Allocate node that will not be indexed in the backend. In this case, we need to propagate that info to its correspondent stage or initial node, which are indexed spans.

@drodriguezhdez
drodriguezhdez merged commit bf8eb41 into master Dec 15, 2020
@drodriguezhdez
drodriguezhdez deleted the drodriguezhdez/stage_queue_time branch December 15, 2020 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/Added Added features results into a minor version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants