Skip to content

Commit

Permalink
Implement suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: Saswata Mukherjee <[email protected]>
  • Loading branch information
saswatamcode committed Oct 21, 2024
1 parent 251d2b0 commit b640793
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions cmd/avalanche/avalanche.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion metrics/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b640793

Please sign in to comment.