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

Added workflow elapsed time metric #32

Merged
merged 4 commits into from
Mar 19, 2024
Merged

Conversation

fheinecke
Copy link
Collaborator

  • Added workflow elapsed time metric
  • Updated docs

collector.go Outdated Show resolved Hide resolved
collector.go Outdated Show resolved Hide resolved
collector.go Outdated Show resolved Hide resolved
collector.go Outdated
// This brings a multitude of issues that are near-impossible to
// account for due to GH's API design.
if run.GetRunAttempt() > 1 {
return
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should still count the step and job times since they all complete and can provide meaningful data. But we should not count them towards the workflow counters.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The problem is that that this really screws up any query that depends on both a "time" metric and a "count" metric. For example, I'm writing a query that gets the average runner time of a workflow. This is basically increase(gha_workflow_runner_seconds / gha_workflow_run_count{conclusion = "success") over an interval. If we count successful runs without counting the run time (in the case of more than one run attempt where a later run was successful) then the average runner time metric is reported as lower than it actually is.

However I'm not sure if dropping metrics for workflow runs with more than one attempts is the right approach. Doing so may screw up some other metric and/or query.

What do you think?

Copy link
Collaborator

@camscale camscale Mar 19, 2024

Choose a reason for hiding this comment

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

I'm not suggesting we increase the workflow run count and not the runner time. I'm suggesting we do neither when the attempt > 1 (or is not successful). Just that in this case there the run attempt is > 1, we still tally up the job and step time and counts. If you are comparing across job/step and workflow there may be a mismatch but I could not think of anything you'd want to compare that way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahh I see. I'll make that change.

@fheinecke fheinecke merged commit 548b7bf into main Mar 19, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants