From 149d66f9958fecc228603f26dc206030e620660b Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Wed, 8 Aug 2018 16:45:15 +0100 Subject: [PATCH 1/2] Remove "url" from RSS metric It's not really that useful --- .../matrix-org/go-neb/services/rssbot/rssbot.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go b/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go index 7d65271..490d548 100644 --- a/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go +++ b/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go @@ -30,7 +30,7 @@ var ( pollCounter = prometheus.NewCounterVec(prometheus.CounterOpts{ Name: "goneb_rss_polls_total", Help: "The number of feed polls from RSS services", - }, []string{"url", "http_status"}) + }, []string{"http_status"}) ) const minPollingIntervalSeconds = 60 * 5 // 5 min (News feeds can be genuinely spammy) @@ -200,21 +200,15 @@ func (s *Service) OnPoll(cli *gomatrix.Client) time.Time { } func incrementMetrics(urlStr string, err error) { - // extract domain part of RSS feed URL to get coarser (more useful) statistics - domain := urlStr - u, urlErr := url.Parse(urlStr) - if urlErr == nil { - domain = u.Host - } if err != nil { herr, ok := err.(gofeed.HTTPError) statusCode := 0 // e.g. network timeout if ok { statusCode = herr.StatusCode } - pollCounter.With(prometheus.Labels{"url": domain, "http_status": strconv.Itoa(statusCode)}).Inc() + pollCounter.With(prometheus.Labels{"http_status": strconv.Itoa(statusCode)}).Inc() } else { - pollCounter.With(prometheus.Labels{"url": domain, "http_status": "200"}).Inc() // technically 2xx but gofeed doesn't tell us which + pollCounter.With(prometheus.Labels{"http_status": "200"}).Inc() // technically 2xx but gofeed doesn't tell us which } } From 468cc87b1d0835466f5a6790992dc10158497611 Mon Sep 17 00:00:00 2001 From: Will Hunt Date: Thu, 9 Aug 2018 10:51:45 +0100 Subject: [PATCH 2/2] Drop unused dependency --- src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go | 1 - 1 file changed, 1 deletion(-) diff --git a/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go b/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go index 490d548..2fae906 100644 --- a/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go +++ b/src/github.com/matrix-org/go-neb/services/rssbot/rssbot.go @@ -6,7 +6,6 @@ import ( "fmt" "html" "net/http" - "net/url" "strconv" "time"