Skip to content

Commit

Permalink
Add log entry when monitor not starting
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Aug 24, 2020
1 parent eed2767 commit 27aa5b8
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,14 +523,16 @@ func startMonitor(ctx context.Context) (metrics.Service, error) {
log.Trace().Msg("Starting metrics service")
var monitor metrics.Service
var err error
if viper.GetString("metrics.listen-address") != "" {
monitor, err = prometheusmetrics.New(ctx,
prometheusmetrics.WithLogLevel(logLevel(viper.GetString("log-levels.metrics"))),
prometheusmetrics.WithAddress(viper.GetString("metrics.listen-address")),
)
if err != nil {
return nil, errors.Wrap(err, "failed to start metrics service")
}
if viper.GetString("metrics.listen-address") == "" {
log.Debug().Msg("No metrics listen address supplied; monitor not starting")
return nil, nil
}
monitor, err = prometheusmetrics.New(ctx,
prometheusmetrics.WithLogLevel(logLevel(viper.GetString("log-levels.metrics"))),
prometheusmetrics.WithAddress(viper.GetString("metrics.listen-address")),
)
if err != nil {
return nil, errors.Wrap(err, "failed to start metrics service")
}
return monitor, nil
}
Expand Down

0 comments on commit 27aa5b8

Please sign in to comment.