From efe1ce963f6513bd9d0e492647bcbd21cdf03beb Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Mon, 11 Dec 2017 21:51:58 +0000 Subject: [PATCH] Fix incomplete commit 9d388e It left the Prometheus instrumentation in server/http.go, while it is already provided by the ai3/go-common package. --- server/http.go | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/server/http.go b/server/http.go index 1c97ff4..c42f60c 100644 --- a/server/http.go +++ b/server/http.go @@ -18,8 +18,6 @@ import ( "github.com/gorilla/csrf" "github.com/gorilla/mux" "github.com/gorilla/sessions" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promhttp" "git.autistici.org/id/auth" authclient "git.autistici.org/id/auth/client" @@ -64,8 +62,6 @@ func newAuthSession(ttl time.Duration, username string, userinfo *auth.UserInfo) func init() { gob.Register(&authSession{}) - - prometheus.MustRegister(totalRequests, inFlightRequests) } // Returns the URL of the login handler on the target service. @@ -278,13 +274,11 @@ func (h *Server) Handler() http.Handler { AssetInfo: AssetInfo, Prefix: "static", }))) - m.Handle("/metrics", promhttp.Handler()) m.Handle("/exchange", withDynamicHeaders(http.HandlerFunc(h.handleExchange))) m.Handle("/", withDynamicHeaders(h.withAuth(h.handleHomepage))) - return promhttp.InstrumentHandlerInFlight(inFlightRequests, - promhttp.InstrumentHandlerCounter(totalRequests, m)) + return m } // A relatively strict CSP. @@ -303,23 +297,6 @@ func withDynamicHeaders(h http.Handler) http.Handler { }) } -// Instrumentation. -var ( - totalRequests = prometheus.NewCounterVec( - prometheus.CounterOpts{ - Name: "total_requests", - Help: "Total number of requests.", - }, - []string{"code"}, - ) - inFlightRequests = prometheus.NewGauge( - prometheus.GaugeOpts{ - Name: "inflight_requests", - Help: "Number of in-flight requests.", - }, - ) -) - // Parse the templates that are embedded with the binary (in bindata.go). func parseEmbeddedTemplates() *template.Template { root := template.New("").Funcs(template.FuncMap{ -- GitLab