MVC: Consider adding the duration of each job in the pipeline graph

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Release notes

Problem to solve

As a DevOps Engineer looking at a long running pipeline, I want to see which jobs run longest in a stage, so I can troubleshoot the likeliest problem so i'm not wasting time.

Proposal

Pasted_image_at_2018-09-20__11_52_AM

We might put this in a tooltip on the Pipelines page

Screen_Shot_2021-11-16_at_11.16.07_AM

Or on the Pipeline detail page either on the stage view

Screen_Shot_2021-11-16_at_11.16.32_AM

or the Needs view

Screen_Shot_2021-11-16_at_11.17.25_AM

Technical Details

Original from this comment.

I looked at how we do it for pipelines and it seems that we persist the duration value in the pipelines table when there is a status change to one of the completed statuses: https://gitlab.com/gitlab-org/gitlab/-/blob/52b3971c88e8a405b2b247b0835829b8660465fd/app/models/ci/pipeline.rb#L204-211 I think we should do the same for stages.

The documentation for the code used to compute this duration is really nice: https://gitlab.com/gitlab-org/gitlab/-/blob/52b3971c88e8a405b2b247b0835829b8660465fd/lib/gitlab/ci/pipeline/duration.rb

Intended users

Metrics

This page may contain information related to upcoming products, features and functionality. It is important to note that the information presented is for informational purposes only, so please do not rely on the information for purchasing or planning purposes. Just like with all projects, the items mentioned on the page are subject to change or delay, and the development, release, and timing of any products, features, or functionality remain at the sole discretion of GitLab Inc.

Edited by 🤖 GitLab Bot 🤖