diff options
author | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-01-26 00:11:28 +0300 |
---|---|---|
committer | Z.J. van de Weg <git@zjvandeweg.nl> | 2017-02-02 23:52:30 +0300 |
commit | 1e31fac9d8a60efb3b2b536a46e059f286ab62c0 (patch) | |
tree | 3d751e07782a5e9489a46d6f4c6a96ea34cb08e6 /helpers_test.go | |
parent | bc4aa822bff4ec2a3a3fdb1daa915782331ad08a (diff) |
Prometheus monitoring for GitLab Pages
This starts of the prometheus monitoring for GitLab Pages, and
resolves gitlab-org/gitlab-pages#42
Point to check:
- Are the metric names good, keeping Prometheus' conventions in mind?
- Golang, general style etc
- Shouldn't I do some voodoo magic to import this in the library?
Diffstat (limited to 'helpers_test.go')
-rw-r--r-- | helpers_test.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/helpers_test.go b/helpers_test.go index 3bab08e0..4e5c3d93 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -124,7 +124,7 @@ func (l ListenSpec) JoinHostPort() string { // GetPageFromProcess to do a HTTP GET against a listener. // // If run as root via sudo, the gitlab-pages process will drop privileges -func RunPagesProcess(t *testing.T, pagesPath string, listeners []ListenSpec) (teardown func()) { +func RunPagesProcess(t *testing.T, pagesPath string, listeners []ListenSpec, promPort string) (teardown func()) { var tempfiles []string var args []string var hasHTTPS bool @@ -146,14 +146,18 @@ func RunPagesProcess(t *testing.T, pagesPath string, listeners []ListenSpec) (te args = append(args, "-root-key", key, "-root-cert", cert) } + if promPort != "" { + args = append(args, "-metrics-address", promPort) + } + if os.Geteuid() == 0 && os.Getenv("SUDO_UID") != "" && os.Getenv("SUDO_GID") != "" { t.Log("Pages process will drop privileges") args = append(args, "-daemon-uid", os.Getenv("SUDO_UID"), "-daemon-gid", os.Getenv("SUDO_GID")) } cmd := exec.Command(pagesPath, args...) - t.Logf("Running %s %v", pagesPath, args) cmd.Start() + fmt.Println("Running %s %v", pagesPath, args) // Wait for all TCP servers to be open. Even with this, gitlab-pages // will sometimes return 404 if a HTTP request comes in before it has |