Skip to content

Report the elapsed time for each workflow step#2700

Merged
mergify[bot] merged 2 commits intonektos:masterfrom
ptagl:step-elapsed-time
Mar 18, 2025
Merged

Report the elapsed time for each workflow step#2700
mergify[bot] merged 2 commits intonektos:masterfrom
ptagl:step-elapsed-time

Conversation

@ptagl
Copy link
Contributor

@ptagl ptagl commented Mar 18, 2025

The runStepExecutor was extended to track and report the execution time of the step.

This applies both to the standard and JSON log formats.

Please, note that:

  • on the standard log the time format depends on the value (e.g. 3.038334954s or 2m0.054014069s)
  • on the JSON log the time format is nanoseconds

Standard log example:

[ci/job1]   ✅  Success - Main Step 1 [1.039520012s]
...
[ci/job2]   ❌  Failure - Main Step B [33.150896ms]

JSON log example:

{"dryrun":false,"executionTime":1039563535,"job":"ci/job1","jobID":"job1","level":"info","matrix":{},"msg":"  ✅  Success - Main Step 1 [1.039563535s]","stage":"Main","step":"Step 1","stepID":["0"],"stepResult":"success","time":"2025-03-17T10:17:21+01:00"}
...
{"dryrun":false,"executionTime":33176679,"job":"ci/job2","jobID":"job2","level":"info","matrix":{},"msg":"  ❌  Failure - Main Step B [33.176679ms]","stage":"Main","step":"Step B","stepID":["1"],"stepResult":"failure","time":"2025-03-18T07:28:01+01:00"}

Related to #2660.

The `runStepExecutor` was extended to track and report the execution time of the step.

This applies both to the standard and JSON log format.

Please, note that:
- on the standard log the time format depends on the value (e.g. `3.038334954s` or `2m0.054014069s`)
- on the JSON log the time format is nanoseconds
@ChristopherHX
Copy link
Contributor

Please update

logger.WithField("stepResult", stepResult.Outcome).Errorf("  \u274C  Failure - %s %s", stage, stepString)

as well. Only the success result has been changed

@codecov
Copy link

codecov bot commented Mar 18, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.42%. Comparing base (5a80a04) to head (4cc37b7).
Report is 188 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2700       +/-   ##
===========================================
+ Coverage   61.56%   74.42%   +12.85%     
===========================================
  Files          53       72       +19     
  Lines        9002    11064     +2062     
===========================================
+ Hits         5542     8234     +2692     
+ Misses       3020     2193      -827     
- Partials      440      637      +197     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@ChristopherHX ChristopherHX 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 to me 👍

@mergify mergify bot merged commit 0098044 into nektos:master Mar 18, 2025
12 checks passed
@ptagl ptagl deleted the step-elapsed-time branch March 18, 2025 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants