Browse Source

s/sendMetric/incrementMetrics/

pull/91/head
Kegan Dougal 8 years ago
parent
commit
f493a1933e
  1. 6
      src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

6
src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go

@ -136,10 +136,10 @@ func (s *rssBotService) OnPoll(cli *matrix.Client) time.Time {
feed, items, err := s.queryFeed(u) feed, items, err := s.queryFeed(u)
if err != nil { if err != nil {
logger.WithField("feed_url", u).WithError(err).Error("Failed to query feed") logger.WithField("feed_url", u).WithError(err).Error("Failed to query feed")
sendMetric(u, err)
incrementMetrics(u, err)
continue continue
} }
sendMetric(u, nil)
incrementMetrics(u, nil)
// Loop backwards since [0] is the most recent and we want to send in chronological order // Loop backwards since [0] is the most recent and we want to send in chronological order
for i := len(items) - 1; i >= 0; i-- { for i := len(items) - 1; i >= 0; i-- {
item := items[i] item := items[i]
@ -161,7 +161,7 @@ func (s *rssBotService) OnPoll(cli *matrix.Client) time.Time {
return s.nextTimestamp() return s.nextTimestamp()
} }
func sendMetric(urlStr string, err error) {
func incrementMetrics(urlStr string, err error) {
// extract domain part of RSS feed URL to get coarser (more useful) statistics // extract domain part of RSS feed URL to get coarser (more useful) statistics
domain := urlStr domain := urlStr
u, urlErr := url.Parse(urlStr) u, urlErr := url.Parse(urlStr)

Loading…
Cancel
Save