From 28d0eb97534e5b18ad2012ec2a04b693c383a901 Mon Sep 17 00:00:00 2001 From: Ivan Krutov Date: Wed, 24 Jul 2019 15:07:19 +0300 Subject: [PATCH] Added ability to build Ggr with pprof support (fixes #281) --- pprof.go | 5 +++++ proxy.go | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 pprof.go diff --git a/pprof.go b/pprof.go new file mode 100644 index 0000000..4526fa1 --- /dev/null +++ b/pprof.go @@ -0,0 +1,5 @@ +// +build pprof + +package main + +import _ "net/http/pprof" diff --git a/proxy.go b/proxy.go index 93e01d9..422dc01 100644 --- a/proxy.go +++ b/proxy.go @@ -39,7 +39,7 @@ const ( ) var paths = struct { - Ping, Status, Err, Host, Quota, Route, Proxy, VNC, Video, Logs, Download, Clipboard, Devtools string + Ping, Status, Err, Host, Quota, Route, Proxy, VNC, Video, Logs, Download, Clipboard, Devtools, Pprof string }{ Ping: "/ping", Status: "/wd/hub/status", @@ -54,6 +54,7 @@ var paths = struct { Download: "/download/", Clipboard: "/clipboard/", Devtools: "/devtools/", + Pprof: "/debug/pprof/", } var keys = struct { @@ -767,5 +768,6 @@ func mux() http.Handler { mux.HandleFunc(paths.Download, WithSuitableAuthentication(authenticator, download)) mux.HandleFunc(paths.Clipboard, WithSuitableAuthentication(authenticator, clipboard)) mux.HandleFunc(paths.Devtools, devtools) + mux.Handle(paths.Pprof, http.DefaultServeMux) return mux }