Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 10 commits into from
Dec 15, 2020

Conversation

drodriguezhdez
Copy link
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
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

Copy link
Collaborator Author

@drodriguezhdez drodriguezhdez Dec 15, 2020

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.

Copy link
Contributor

@FlorianVeaux FlorianVeaux left a comment

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
Copy link
Collaborator Author

drodriguezhdez commented Dec 15, 2020

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