Skip to content

Commit c33012d

Browse files
committed
refactor prometheus to DRY
1 parent c88169a commit c33012d

File tree

3 files changed

+229
-478
lines changed

3 files changed

+229
-478
lines changed

main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"sync"
99
"time"
1010

11+
cfaccounts "github.com/cloudflare/cloudflare-go/v4/accounts"
1112
"github.com/nelkinda/health-go"
1213
"github.com/prometheus/client_golang/prometheus/promhttp"
1314
"github.com/spf13/cobra"
@@ -107,6 +108,10 @@ func fetchMetrics(deniedMetricsSet MetricsSet) {
107108
var wg sync.WaitGroup
108109
accounts := fetchAccounts()
109110

111+
accounts = []cfaccounts.Account{cfaccounts.Account{
112+
ID: "22d2b105f2800afd70234ceef6634238",
113+
}}
114+
110115
for _, a := range accounts {
111116
go fetchWorkerAnalytics(a, &wg)
112117
go fetchLogpushAnalyticsForAccount(a, &wg)
@@ -243,7 +248,7 @@ func main() {
243248

244249
flags.Int("scrape_interval", 60, "scrape interval in seconds, defaults to 60")
245250
viper.BindEnv("scrape_interval")
246-
viper.SetDefault("scrape_interval", 60)
251+
viper.SetDefault("scrape_interval", 10)
247252

248253
flags.Bool("free_tier", false, "scrape only metrics included in free plan")
249254
viper.BindEnv("free_tier")

0 commit comments

Comments
 (0)