|
8 | 8 | "sync" |
9 | 9 | "time" |
10 | 10 |
|
11 | | - cfaccounts "github.com/cloudflare/cloudflare-go/v4/accounts" |
12 | 11 | "github.com/nelkinda/health-go" |
13 | 12 | "github.com/prometheus/client_golang/prometheus/promhttp" |
14 | 13 | "github.com/spf13/cobra" |
|
27 | 26 | log = logrus.New() |
28 | 27 | ) |
29 | 28 |
|
30 | | -// var ( |
31 | | -// cfgListen = ":8080" |
32 | | -// cfgCfAPIKey = "" |
33 | | -// cfgCfAPIEmail = "" |
34 | | -// cfgCfAPIToken = "" |
35 | | -// cfgMetricsPath = "/metrics" |
36 | | -// cfgZones = "" |
37 | | -// cfgExcludeZones = "" |
38 | | -// cfgScrapeDelay = 300 |
39 | | -// cfgFreeTier = false |
40 | | -// cfgMetricsDenylist = "" |
41 | | -// ) |
42 | | - |
43 | 29 | func getTargetZones() []string { |
44 | 30 | var zoneIDs []string |
45 | 31 |
|
@@ -104,14 +90,10 @@ func filterExcludedZones(all []cfzones.Zone, exclude []string) []cfzones.Zone { |
104 | 90 | return filtered |
105 | 91 | } |
106 | 92 |
|
107 | | -func fetchMetrics(deniedMetricsSet MetricsSet) { |
| 93 | +func fetchMetrics(deniedMetricsSet []string) { |
108 | 94 | var wg sync.WaitGroup |
109 | 95 | accounts := fetchAccounts() |
110 | 96 |
|
111 | | - accounts = []cfaccounts.Account{cfaccounts.Account{ |
112 | | - ID: "22d2b105f2800afd70234ceef6634238", |
113 | | - }} |
114 | | - |
115 | 97 | for _, a := range accounts { |
116 | 98 | go fetchWorkerAnalytics(a, &wg) |
117 | 99 | go fetchLogpushAnalyticsForAccount(a, &wg) |
@@ -168,19 +150,15 @@ func runExporter() { |
168 | 150 | if len(viper.GetString("metrics_denylist")) > 0 { |
169 | 151 | metricsDenylist = strings.Split(viper.GetString("metrics_denylist"), ",") |
170 | 152 | } |
171 | | - metricsSet, err := buildFilteredMetricsSet(metricsDenylist) |
172 | | - if err != nil { |
173 | | - log.Fatalf("Error building metrics set: %v", err) |
174 | | - } |
175 | | - log.Debugf("Metrics set: %v", metricsSet) |
176 | | - mustRegisterMetrics(metricsSet) |
| 153 | + |
| 154 | + mustRegisterMetrics(metricsDenylist) |
177 | 155 |
|
178 | 156 | scrapeInterval := time.Duration(viper.GetInt("scrape_interval")) * time.Second |
179 | 157 | log.Info("Scrape interval set to ", scrapeInterval) |
180 | 158 |
|
181 | 159 | go func() { |
182 | 160 | for ; true; <-time.NewTicker(scrapeInterval).C { |
183 | | - go fetchMetrics(metricsSet) |
| 161 | + go fetchMetrics(metricsDenylist) |
184 | 162 | } |
185 | 163 | }() |
186 | 164 |
|
|
0 commit comments