Skip to content
Snippets Groups Projects
Commit d037f6fb authored by ale's avatar ale
Browse files

Add a metric for the total number of proxied connections

It should allow us to tell apart SSL and non-SSL connections.
parent ad594df5
Branches
No related tags found
No related merge requests found
......@@ -37,6 +37,13 @@ var (
},
[]string{"stream", "upstream"},
)
proxyConnections = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "proxy_connections_total",
Help: "Proxy connections.",
},
[]string{"proto"},
)
// Node metrics.
icecastUpdateFailed = prometheus.NewGauge(
......
......@@ -107,12 +107,14 @@ func doIcecastProxy(rw http.ResponseWriter, req *http.Request, target *url.URL,
// httputil.ReverseProxy (not fully functional for sources, but
// meh).
if req.TLS != nil {
proxyConnections.WithLabelValues("https").Inc()
u := *outreq.URL
u.Path = "/"
rp := httputil.NewSingleHostReverseProxy(&u)
rp.ServeHTTP(rw, outreq)
return
}
proxyConnections.WithLabelValues("http").Inc()
// Create the upstream connection and write the HTTP request
// to it.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment