From d9ecb21a30a356228a233692a5bf91ca2a9cf664 Mon Sep 17 00:00:00 2001 From: artyrian Date: Tue, 16 Apr 2024 23:26:08 +0300 Subject: [PATCH 1/2] support ipv6 --- pkg/server/server.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/server/server.go b/pkg/server/server.go index c99a0be..3989d48 100644 --- a/pkg/server/server.go +++ b/pkg/server/server.go @@ -2,6 +2,7 @@ package server import ( "log" + "net" "strconv" "github.com/fasthttp/router" @@ -30,6 +31,7 @@ func RunServer(ctx *cli.Context) error { r.GET("/debug/pprof/{profile}", pprofHandlerIndex) } - log.Print("exporter listening on 0.0.0.0:" + strconv.Itoa(config.Port)) - return fasthttp.ListenAndServe(":"+strconv.Itoa(config.Port), r.Handler) + log.Print("exporter listening on 0.0.0.0::" + strconv.Itoa(config.Port)) + ln, _ := net.Listen("tcp", ":"+strconv.Itoa(config.Port)) + return fasthttp.Serve(ln, r.Handler) } From ed579d3c486e846531c2764b2f4a7a0f6621c50b Mon Sep 17 00:00:00 2001 From: artyrian Date: Tue, 16 Apr 2024 23:59:33 +0300 Subject: [PATCH 2/2] reset metrics --- pkg/metrics/get_billable_from_github.go | 2 ++ pkg/metrics/get_runners_from_github.go | 2 ++ pkg/metrics/get_workflow_runs_from_github.go | 3 +++ 3 files changed, 7 insertions(+) diff --git a/pkg/metrics/get_billable_from_github.go b/pkg/metrics/get_billable_from_github.go index 23f2fc8..744fada 100644 --- a/pkg/metrics/get_billable_from_github.go +++ b/pkg/metrics/get_billable_from_github.go @@ -26,6 +26,8 @@ var ( // getBillableFromGithub - return billable informations for MACOS, WINDOWS and UBUNTU runners. func getBillableFromGithub() { for { + workflowBillGauge.Reset() + for _, repo := range repositories { for k, v := range workflows[repo] { r := strings.Split(repo, "/") diff --git a/pkg/metrics/get_runners_from_github.go b/pkg/metrics/get_runners_from_github.go index f0b2260..bc5ab45 100644 --- a/pkg/metrics/get_runners_from_github.go +++ b/pkg/metrics/get_runners_from_github.go @@ -51,6 +51,8 @@ func getAllRepoRunners(owner string, repo string) []*github.Runner { // getRunnersFromGithub - return information about runners and their status for a specific repo func getRunnersFromGithub() { for { + runnersGauge.Reset() + for _, repo := range repositories { r := strings.Split(repo, "/") diff --git a/pkg/metrics/get_workflow_runs_from_github.go b/pkg/metrics/get_workflow_runs_from_github.go index 4e376f1..e47c4d0 100644 --- a/pkg/metrics/get_workflow_runs_from_github.go +++ b/pkg/metrics/get_workflow_runs_from_github.go @@ -106,6 +106,9 @@ func getRunUsage(owner string, repo string, runId int64) *github.WorkflowRunUsag // getWorkflowRunsFromGithub - return informations and status about a workflow func getWorkflowRunsFromGithub() { for { + workflowRunStatusGauge.Reset() + workflowRunDurationGauge.Reset() + for _, repo := range repositories { r := strings.Split(repo, "/") runs := getRecentWorkflowRuns(r[0], r[1])