diff --git a/cmd/avalanche/avalanche.go b/cmd/avalanche/avalanche.go index 0041b37..0e8b69e 100644 --- a/cmd/avalanche/avalanche.go +++ b/cmd/avalanche/avalanche.go @@ -61,22 +61,21 @@ func main() { cfg := metrics.NewConfigFromFlags(kingpin.Flag) port := kingpin.Flag("port", "Port to serve at").Default("9001").Int() - remoteWriteConfig := metrics.NewRemoteWriteConfigFromFlags(kingpin.Flag) + remoteWriteConfig := metrics.NewWriteConfigFromFlags(kingpin.Flag) kingpin.Parse() if err := cfg.Validate(); err != nil { kingpin.FatalUsage("configuration error: %v", err) } + if err := remoteWriteConfig.Validate(); err != nil { + kingpin.FatalUsage("remote write config validation failed: %v", err) + } collector := metrics.NewCollector(*cfg) reg := prometheus.NewRegistry() reg.MustRegister(collector) remoteWriteConfig.UpdateNotify = collector.UpdateNotifyCh() - if err := remoteWriteConfig.Validate(); err != nil { - kingpin.FatalUsage("remote write config validation failed: %v", err) - } - log.Println("initializing avalanche...") var g run.Group diff --git a/metrics/write.go b/metrics/write.go index 2872518..59767fc 100644 --- a/metrics/write.go +++ b/metrics/write.go @@ -57,7 +57,7 @@ type ConfigWrite struct { Concurrency int } -func NewRemoteWriteConfigFromFlags(flagReg func(name, help string) *kingpin.FlagClause) *ConfigWrite { +func NewWriteConfigFromFlags(flagReg func(name, help string) *kingpin.FlagClause) *ConfigWrite { cfg := &ConfigWrite{} flagReg("remote-url", "URL to send samples via remote_write API."). URLVar(&cfg.URL)