diff --git a/docs/docs/CHANGELOG.md b/docs/docs/CHANGELOG.md index cacad87..cb61141 100644 --- a/docs/docs/CHANGELOG.md +++ b/docs/docs/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed CEL expression matching validator to now properly error out when it receives empty expressions - Added OpenRC init.d script. - Added `--version` flag. +- Added `anubis_proxied_requests_total` metric to count proxied requests. ## v1.18.0: Varis zos Galvus diff --git a/lib/anubis.go b/lib/anubis.go index 30cd1bd..e817eed 100644 --- a/lib/anubis.go +++ b/lib/anubis.go @@ -56,6 +56,11 @@ var ( Help: "The time taken for a browser to generate a response (milliseconds)", Buckets: prometheus.ExponentialBucketsRange(1, math.Pow(2, 18), 19), }) + + requestsProxied = promauto.NewCounterVec(prometheus.CounterOpts{ + Name: "anubis_proxied_requests_total", + Help: "Number of requests proxied through Anubis to upstream targets", + }, []string{"host"}) ) type Server struct { diff --git a/lib/http.go b/lib/http.go index 8e40627..0cbae23 100644 --- a/lib/http.go +++ b/lib/http.go @@ -147,6 +147,7 @@ func (s *Server) ServeHTTPNext(w http.ResponseWriter, r *http.Request) { web.Base("You are not a bot!", web.StaticHappy()), ).ServeHTTP(w, r) } else { + requestsProxied.WithLabelValues(r.Host).Inc() s.next.ServeHTTP(w, r) } }