outpost/proxy: fix prometheus errors

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-08 22:41:41 +02:00
parent f7afb60c1f
commit 0a33d38adf
2 changed files with 7 additions and 3 deletions

View File

@ -15,10 +15,12 @@ func (ps *ProxyServer) HandlePing(rw http.ResponseWriter, r *http.Request) {
rw.WriteHeader(204)
after := time.Since(before)
metrics.Requests.With(prometheus.Labels{
"type": "ping",
"method": r.Method,
"schema": r.URL.Scheme,
"path": r.URL.Path,
"host": web.GetHost(r),
"type": "ping",
"user": "",
}).Observe(float64(after))
}
@ -28,10 +30,12 @@ func (ps *ProxyServer) HandleStatic(rw http.ResponseWriter, r *http.Request) {
http.StripPrefix("/akprox/static", staticFs).ServeHTTP(rw, r)
after := time.Since(before)
metrics.Requests.With(prometheus.Labels{
"type": "static",
"method": r.Method,
"schema": r.URL.Scheme,
"path": r.URL.Path,
"host": web.GetHost(r),
"type": "ping",
"user": "",
}).Observe(float64(after))
}

View File

@ -13,7 +13,7 @@ var (
Requests = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "authentik_outpost_proxy_requests",
Help: "The total number of configured providers",
}, []string{"scheme", "type", "method", "path", "host", "user"})
}, []string{"method", "scheme", "path", "host", "type", "user"})
UpstreamTiming = promauto.NewHistogramVec(prometheus.HistogramOpts{
Name: "authentik_outpost_proxy_upstream_time",
Help: "A summary of the duration we wait for the upstream reply",