Record the number of currently running goroutines

This commit is contained in:
Melon 2023-08-25 01:24:32 +01:00
parent 869d114891
commit 8c4aa67e7b
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -11,6 +11,7 @@ import (
"log" "log"
"net/http" "net/http"
"path" "path"
"runtime"
"time" "time"
) )
@ -18,7 +19,7 @@ import (
// endpoints for the reverse proxy. // endpoints for the reverse proxy.
func NewHttpsServer(conf *conf.Conf) *http.Server { func NewHttpsServer(conf *conf.Conf) *http.Server {
r := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) { r := http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
log.Printf("[Debug] Request: %s - '%s' - '%s' - '%s' - len: %d\n", req.Method, req.URL.String(), req.RemoteAddr, req.Host, req.ContentLength) log.Printf("[Debug] Request: %s - '%s' - '%s' - '%s' - len: %d - thread: %d\n", req.Method, req.URL.String(), req.RemoteAddr, req.Host, req.ContentLength, runtime.NumGoroutine())
conf.Router.ServeHTTP(rw, req) conf.Router.ServeHTTP(rw, req)
}) })
favMiddleware := setupFaviconMiddleware(conf.Favicons, r) favMiddleware := setupFaviconMiddleware(conf.Favicons, r)