Skip to content

Commit a077587

Browse files
committed
Finish refactor
1 parent c33012d commit a077587

2 files changed

Lines changed: 408 additions & 379 deletions

File tree

main.go

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,6 @@ var (
2727
log = logrus.New()
2828
)
2929

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-
4330
func getTargetZones() []string {
4431
var zoneIDs []string
4532

@@ -104,7 +91,7 @@ func filterExcludedZones(all []cfzones.Zone, exclude []string) []cfzones.Zone {
10491
return filtered
10592
}
10693

107-
func fetchMetrics(deniedMetricsSet MetricsSet) {
94+
func fetchMetrics(deniedMetricsSet []string) {
10895
var wg sync.WaitGroup
10996
accounts := fetchAccounts()
11097

@@ -168,19 +155,15 @@ func runExporter() {
168155
if len(viper.GetString("metrics_denylist")) > 0 {
169156
metricsDenylist = strings.Split(viper.GetString("metrics_denylist"), ",")
170157
}
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)
158+
159+
mustRegisterMetrics(metricsDenylist)
177160

178161
scrapeInterval := time.Duration(viper.GetInt("scrape_interval")) * time.Second
179162
log.Info("Scrape interval set to ", scrapeInterval)
180163

181164
go func() {
182165
for ; true; <-time.NewTicker(scrapeInterval).C {
183-
go fetchMetrics(metricsSet)
166+
go fetchMetrics(metricsDenylist)
184167
}
185168
}()
186169

0 commit comments

Comments
 (0)