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:
authorJacob Vosmaer (GitLab) <jacob@gitlab.com>2017-11-21 18:41:02 +0300
committerJacob Vosmaer (GitLab) <jacob@gitlab.com>2017-11-21 18:41:02 +0300
commitc5b6f4bae77c792a93622778f363f26478955f94 (patch)
tree5e938221a3550978b9c4d8283a83da6a4956d9ee
parentc112d051165771d87b4e8158d5e39640d5fd8991 (diff)
parent6fe6aa58820eff11c5943911506cf4ae6c2c90c4 (diff)
Merge branch 'an/profiling' into 'master'
Include pprof debug access in the Prometheus listener Closes #707 See merge request gitlab-org/gitaly!442
-rw-r--r--CHANGELOG.md2
-rw-r--r--cmd/gitaly/main.go3
-rw-r--r--internal/server/pprof.go16
3 files changed, 21 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 00589bb45..5cf5fe081 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
UNRELEASED
+- Include pprof debug access in the Prometheus listener
+ https://gitlab.com/gitlab-org/gitaly/merge_requests/442
- Run gitaly-ruby in the same directory as gitaly
https://gitlab.com/gitlab-org/gitaly/merge_requests/458
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)
+}