Skip to content

Commit

Permalink
renable metrics for http
Browse files Browse the repository at this point in the history
Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
  • Loading branch information
kradalby committed Apr 21, 2024
1 parent 231d3c1 commit 644d4d9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hscontrol/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ func (h *Headscale) ensureUnixSocketIsAbsent() error {

func (h *Headscale) createRouter(grpcMux *grpcRuntime.ServeMux) *mux.Router {
router := mux.NewRouter()
// router.Use(prometheusMiddleware)
router.Use(prometheusMiddleware)
router.PathPrefix("/debug/pprof/").Handler(http.DefaultServeMux)

router.HandleFunc(ts2021UpgradePath, h.NoiseUpgradeHandler).Methods(http.MethodPost)
Expand Down
3 changes: 2 additions & 1 deletion hscontrol/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ func prometheusMiddleware(next http.Handler) http.Handler {

// Ignore streaming and noise sessions
// it has its own router further down.
if path == "/ts2021" || path == "/machine/map" {
if path == "/ts2021" || path == "/machine/map" || path == "/derp" || path == "/derp/probe" || path == "/bootstrap-dns" {
next.ServeHTTP(w, r)
return
}

rw := &respWriterProm{ResponseWriter: w}
Expand Down
2 changes: 1 addition & 1 deletion hscontrol/noise.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (h *Headscale) NoiseUpgradeHandler(
// The HTTP2 server that exposes this router is created for
// a single hijacked connection from /ts2021, using netutil.NewOneConnListener
router := mux.NewRouter()
// router.Use(prometheusMiddleware)
router.Use(prometheusMiddleware)

router.HandleFunc("/machine/register", noiseServer.NoiseRegistrationHandler).
Methods(http.MethodPost)
Expand Down

0 comments on commit 644d4d9

Please sign in to comment.