Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The exporter can be configured using env variables or command flags.
| `CF_TIMEOUT` | Set cloudflare request timeout. Default 10 seconds |
| `LISTEN` | listen on addr:port (default `:8080`), omit addr to listen on all interfaces |
| `METRICS_PATH` | path for metrics, default `/metrics` |
| `SCRAPE_INTERVAL` | scrape interval in seconds (will query cloudflare every SCRAPE_INTERVAL seconds), default `60` |
| `SCRAPE_INTERVAL` | scrape interval (will query cloudflare every SCRAPE_INTERVAL), default `1m` |
| `SCRAPE_DELAY` | shift the time window earlier by this amount, defaults to `1m` |
| `METRICS_DENYLIST` | (Optional) cloudflare-exporter metrics to not export, comma delimited list of cloudflare-exporter metrics. If not set, all metrics are exported |
| `ENABLE_PPROF` | (Optional) enable pprof profiling endpoints at `/debug/pprof/`. Accepts `true` or `false`, default `false`. **Warning**: Only enable in development/debugging environments |
Expand All @@ -76,10 +76,10 @@ Corresponding flags:
-cf_api_token="": cloudflare api token (version 0.0.5+, preferred)
-cf_zones="": cloudflare zones to export, comma delimited list
-cf_exclude_zones="": cloudflare zones to exclude, comma delimited list
-cf_timeout="10s": cloudflare request timeout, default 10 seconds
-cf_timeout="20s": cloudflare request timeout, default 20 seconds
-listen=":8080": listen on addr:port ( default :8080), omit addr to listen on all interfaces
-metrics_path="/metrics": path for metrics, default /metrics
-scrape_interval=60: scrape interval in seconds, defaults to 60
-scrape_interval=1m: scrape interval, defaults to 1m
-scrape_delay=1m: shift the time window earlier by this amount, defaults to 1m
-metrics_denylist="": cloudflare-exporter metrics to not export, comma delimited list
-enable_pprof=false: enable pprof profiling endpoints at /debug/pprof/
Expand Down
10 changes: 5 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func runExporter() {
metric.MustRegisterWith(prometheus.DefaultRegisterer)
}

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

scrapeDelay := viper.GetDuration("scrape_delay")
Expand Down Expand Up @@ -316,13 +316,13 @@ func main() {
viper.BindEnv("scrape_delay")
viper.SetDefault("scrape_delay", 4*time.Minute)

flags.Int("scrape_interval", 60, "scrape interval in seconds, defaults to 60")
flags.Duration("scrape_interval", 1*time.Minute, "scrape interval, defaults to 1 minute")
viper.BindEnv("scrape_interval")
viper.SetDefault("scrape_interval", 60)
viper.SetDefault("scrape_interval", 1*time.Minute)

flags.Duration("cf_timeout", 10*time.Second, "cloudflare request timeout, default 10 seconds")
flags.Duration("cf_timeout", 20*time.Second, "cloudflare request timeout, default 20 seconds")
viper.BindEnv("cf_timeout")
viper.SetDefault("cf_timeout", 10*time.Second)
viper.SetDefault("cf_timeout", 20*time.Second)

flags.String("metrics_denylist", "", "metrics to not expose, comma delimited list")
viper.BindEnv("metrics_denylist")
Expand Down
Loading