Skip to content

Commit

Permalink
Applied review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasbu committed Dec 19, 2022
1 parent b7af6e0 commit dbb13d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 8 additions & 2 deletions reporters/dogstatsd/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ func GruStatusHandler(c dogstatsd.Client, event string,
if err != nil {
return err
}
return c.Gauge(fmt.Sprintf("gru.%s", opts["status"]), gauge, tags, 1)
if err := c.Gauge(fmt.Sprintf("gru.%s", opts["status"]), gauge, tags, 1); err != nil {
return fmt.Errorf("dogstatsd failed to GRU Status gauge %s: %w", opts["status"], err)
}
return nil
}

// GruTimingHandler calls dogstatsd.Client.Timing with tags formatted as key:value
Expand Down Expand Up @@ -134,5 +137,8 @@ func GaugeHandler(
if err != nil {
return err
}
return c.Gauge(event, gauge, tags, 1)
if err := c.Gauge(event, gauge, tags, 1); err != nil {
return fmt.Errorf("dogstatsd failed to gauge %s: %w", opts["status"], err)
}
return nil
}
6 changes: 2 additions & 4 deletions watcher/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,11 @@ func (w *Watcher) reportRoomsStatusesRoutine() {
case <-podStateCountTicker.C:
w.PodStatesCount()
case <-roomStatusTicker.C:
w.Logger.Info("Start to report rooms status")
if err := w.ReportRoomsStatuses(); err != nil {
w.Logger.WithError(err).Error("failed to report room status")
}
w.Logger.Info("Finished to report rooms status")
}
}
}
Expand Down Expand Up @@ -423,8 +425,6 @@ func (w *Watcher) ReportRoomsStatuses() error {
return nil
}

w.Logger.Info("Start to report RoomsStatuses")

var roomCountByStatus *models.RoomsStatusCount
err := w.MetricsReporter.WithSegment(models.SegmentGroupBy, func() error {
var err error
Expand Down Expand Up @@ -484,8 +484,6 @@ func (w *Watcher) ReportRoomsStatuses() error {
}
}

w.Logger.Info("Finished to report RoomsStatuses")

return nil
}

Expand Down

0 comments on commit dbb13d3

Please sign in to comment.