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

Difference in duration as depicted on stage overview vs VSM page #8681

Closed
kritika-singh3 opened this issue Oct 23, 2020 · 3 comments
Closed
Projects

Comments

@kritika-singh3
Copy link
Contributor

Issue Type
  • Bug Report
Summary

Note: Relevant for a pipeline with single stage
The stage duration stated on stage overview (on dashboard, pipeline activity and VSM page) is different from the one stated on VSM page for a given pipeline and stage counter.

Basic environment details
  • Go Version: GoCD Version: 20.9.0 (12319-184c7cbcfbeabe576f9851f9bff84978bd48a716)
Steps to Reproduce
Config to use
<pipeline name="p5">
      <materials>
        <git url="/tmp/materials/test" />
      </materials>
      <stage name="s">
        <jobs>
          <job name="j" timeout="10">
            <tasks>
              <exec command="ls" />
              <exec command="env">
                <runif status="passed" />
              </exec>
            </tasks>
          </job>
          <job name="j1" timeout="0">
            <tasks>
              <exec command="sleep">
                <arg>100</arg>
                <runif status="passed" />
              </exec>
              <exec command="la">
                <runif status="passed" />
              </exec>
            </tasks>
          </job>
        </jobs>
      </stage>
    </pipeline>
  1. Run the pipeline. Let it complete
  2. Rerun the job j1 i.e. the failing one. Let it complete.
  3. Visit the VSM page (via the link on dashboard)
  4. Open up the stage overview.
Expected Results

The stage duration stated on stage overview should be the same as one stated in the pipeline box.

Actual Results

The durations are different.

Code snippets/Screenshots

Screen Shot 2020-10-23 at 12 28 36 PM

Any other info

This behaviour is not noticed if the entire stage is rerun.

@kritika-singh3 kritika-singh3 added this to the NextUp milestone Oct 23, 2020
@kritika-singh3
Copy link
Contributor Author

The issue is present in pipelines with multiple stages as well but it might not be noticeable immediately.

@maheshp
Copy link
Contributor

maheshp commented Oct 23, 2020

To understand how duration is calculated, lets assume a Stage S which has re-run and hence has counter 1 & 2.

Duration calculation on VSM and Stage details page:
duration = stage(counter 2).createdTime - stage((counter 2)).lastTransitionedTime

Duration calculation on Stage overview:
duration = stage(counter 1).createdTime - stage((counter 2)).lastTransitionedTime

I think we should change the duration on the Stage Overview to be same as on the Stage details and VSM page.
I understand that as part of the re-run, jobs which are passed in the the previous runs are mapped to it guess that is the reason duration calculation considers the duration from the previous stage counter.
But a rerun would create a new Stage instance which has different createdTime, this is displayed on the stage details page. I think we should rely on this to calculate the stage duration.

maheshp added a commit to maheshp/gocd that referenced this issue Oct 27, 2020
* v3 of the API adds attributes 'created_time' and 'last_transition_time'
* Deprecated v2 of the API
maheshp added a commit to maheshp/gocd that referenced this issue Oct 27, 2020
…nsition time gocd#8681

* Stage duration is calculated based on stage created time and last
  transitioned time now returned as part of the Stages API.
@kritika-singh3 kritika-singh3 modified the milestones: NextUp, Release 20.9.0 Oct 27, 2020
@kritika-singh3 kritika-singh3 added this to To do in 20.9.0 Oct 27, 2020
maheshp added a commit to maheshp/gocd that referenced this issue Oct 28, 2020
* v3 of the API adds attributes 'created_time' and 'last_transition_time'
* Deprecated v2 of the API
maheshp added a commit to maheshp/gocd that referenced this issue Oct 28, 2020
…nsition time gocd#8681

* Stage duration is calculated based on stage created time and last
  transitioned time now returned as part of the Stages API.
maheshp added a commit to maheshp/gocd that referenced this issue Oct 28, 2020
…nsition time gocd#8681

* Stage duration is calculated based on stage created time and last
  transitioned time now returned as part of the Stages API.
@maheshp maheshp moved this from To do to Done in 20.9.0 Oct 28, 2020
@kritika-singh3
Copy link
Contributor Author

Fixed in #8690. Verified on GoCD Version: 20.9.0 (12318-b67833a26e7273f83019facdf22dfcfd290cdf4a)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
20.9.0
QA Done
Development

No branches or pull requests

2 participants