Skip to content

Commit 0493b4b

Browse files
committed
fix: github_runner_status
The busy label creates metrics duplicates with the wrong status. We need to reset runner status before fill it.
1 parent 5bab894 commit 0493b4b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

pkg/metrics/get_runners_from_github.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ func getRunnersFromGithub() {
3030
if err != nil {
3131
log.Printf("ListRunners error for %s: %s", repo, err.Error())
3232
} else {
33+
runnersGauge.Reset()
34+
3335
for _, runner := range resp.Runners {
3436
if runner.GetStatus() == "online" {
3537
runnersGauge.WithLabelValues(repo, *runner.OS, *runner.Name, strconv.FormatInt(runner.GetID(), 10), strconv.FormatBool(runner.GetBusy())).Set(1)

pkg/metrics/get_runners_organization_from_github.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ func getRunnersOrganizationFromGithub() {
3131
if err != nil {
3232
log.Printf("ListOrganizationRunners error for %s: %s", orga, err.Error())
3333
} else {
34+
runnersGauge.Reset()
35+
3436
for _, runner := range resp.Runners {
3537
if runner.GetStatus() == "online" {
3638
runnersOrganizationGauge.WithLabelValues(orga, *runner.OS, *runner.Name, strconv.FormatInt(runner.GetID(), 10), strconv.FormatBool(runner.GetBusy())).Set(1)

0 commit comments

Comments
 (0)