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 event and ref labels #27

Merged
merged 2 commits into from
Mar 16, 2024
Merged

Added event and ref labels #27

merged 2 commits into from
Mar 16, 2024

Conversation

fheinecke
Copy link
Collaborator

@fheinecke fheinecke commented Mar 14, 2024

Here's an example of the changes:

gha_workflow_run_time_seconds{event_type="schedule",ref="master",repo="teleport",workflow="dismiss"} 27
gha_step_run_time_seconds{event_type="schedule",job="Dismiss Stale Workflow Runs",ref="master",repo="teleport",step="Dismiss",workflow="dismiss"} 24
gha_step_run_count{conclusion="success",event_type="schedule",job="Dismiss Stale Workflow Runs",ref="master",repo="teleport",step="Dismiss",workflow="dismiss"} 1
gha_job_run_time_seconds{event_type="schedule",job="Dismiss Stale Workflow Runs",ref="master",repo="teleport",workflow="dismiss"} 27
gha_job_run_count{conclusion="success",event_type="schedule",job="Dismiss Stale Workflow Runs",ref="master",repo="teleport",workflow="dismiss"} 1

Another, merge group and branch/v14:

gha_step_run_count{conclusion="success",event_type="merge_group",job="Integration Tests (Non-root)",ref="branch/v14",repo="teleport",step="Checkout Teleport",workflow="integration-tests-non-root"} 1

collector.go Outdated Show resolved Hide resolved
collector.go Outdated Show resolved Hide resolved
collector.go Outdated
}
}

return "error-no-matching-pr"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I dont think this is an error - the value should either be empty or "unknown". Not every workflow run with a pull request event will be able to be tied back to a PR - the description of the pull_requests field in the "Get a workflow run" docs says

Pull requests that are open with a head_sha or head_branch that matches the workflow run. The returned pull requests do not necessarily indicate pull requests that triggered the run.

So if the pull request has closed at the time we query the the workflow runs, we may not get a PR. That's not an error, just bad timing, so I don't think the value should indicate an error.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you think "error-no-matching-open-pr" would be better, or maybe the head branch? I'm attempting to prefix all the "this is not what you would expect and should be filtered out in queries" values with the same prefix.

Pull requests that are open

I really hate this API...

collector.go Show resolved Hide resolved
Copy link
Collaborator

@camscale camscale left a comment

Choose a reason for hiding this comment

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

LGTM. Let's give this a try and see what the metrics look like

@fheinecke fheinecke merged commit edf5a9f into main Mar 16, 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