Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@gitlab.com>2017-11-21 18:41:02 +0300
committerJacob Vosmaer <jacob@gitlab.com>2017-11-23 20:31:41 +0300
commit125488be8a1c3a31f10920239ba6f5ad5a2021f6 (patch)
tree5ee4957a671abc724dfbb567a5cccf9babdf2b84
parentdb266bf379bfb2fd16d7278e3f228e008ca25a47 (diff)
Include pprof debug access in the Prometheus listener
-rw-r--r--CHANGELOG.md5
-rw-r--r--cmd/gitaly/main.go3
-rw-r--r--internal/server/pprof.go16
3 files changed, 24 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9b276b02f..40719cf3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Gitaly changelog
+UNRELEASED
+
+- Include pprof debug access in the Prometheus listener
+ https://gitlab.com/gitlab-org/gitaly/merge_requests/442
+
v0.52.0
- Implement WikiUpdatePage RPC
diff --git a/cmd/gitaly/main.go b/cmd/gitaly/main.go
index e1f887a9c..79ed5a4df 100644
--- a/cmd/gitaly/main.go
+++ b/cmd/gitaly/main.go
@@ -130,6 +130,9 @@ func main() {
log.WithField("address", config.Config.PrometheusListenAddr).Info("Starting prometheus listener")
promMux := http.NewServeMux()
promMux.Handle("/metrics", promhttp.Handler())
+
+ server.AddPprofHandlers(promMux)
+
go func() {
http.ListenAndServe(config.Config.PrometheusListenAddr, promMux)
}()
diff --git a/internal/server/pprof.go b/internal/server/pprof.go
new file mode 100644
index 000000000..ec99bf284
--- /dev/null
+++ b/internal/server/pprof.go
@@ -0,0 +1,16 @@
+package server
+
+import (
+ "net/http"
+ "net/http/pprof"
+)
+
+// AddPprofHandlers added profiling endpoints
+func AddPprofHandlers(serveMux *http.ServeMux) {
+ // Register pprof handlers
+ serveMux.HandleFunc("/debug/pprof/", pprof.Index)
+ serveMux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
+ serveMux.HandleFunc("/debug/pprof/profile", pprof.Profile)
+ serveMux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
+ serveMux.HandleFunc("/debug/pprof/trace", pprof.Trace)
+}