mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-11 12:06:57 +00:00
feat: Add label support to TotalNumberOfQueuedAndInProgressWorkflowRuns metric (#1373)
This is an implementation for my intepretation of the "bronze" case proposed in #1056 Ref #1056
This commit is contained in:
@@ -138,7 +138,23 @@ func (r *HorizontalRunnerAutoscalerReconciler) suggestReplicasByQueuedAndInProgr
|
||||
if len(allJobs) == 0 {
|
||||
fallback_cb()
|
||||
} else {
|
||||
JOB:
|
||||
for _, job := range allJobs {
|
||||
labels := make(map[string]struct{}, len(job.Labels))
|
||||
for _, l := range job.Labels {
|
||||
labels[l] = struct{}{}
|
||||
}
|
||||
|
||||
if _, ok := labels["self-hosted"]; !ok {
|
||||
continue JOB
|
||||
}
|
||||
|
||||
for _, l := range st.labels {
|
||||
if _, ok := labels[l]; !ok {
|
||||
continue JOB
|
||||
}
|
||||
}
|
||||
|
||||
switch job.GetStatus() {
|
||||
case "completed":
|
||||
// We add a case for `completed` so it is not counted in `unknown`.
|
||||
|
||||
Reference in New Issue
Block a user