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:
-rw-r--r--changelogs/unreleased/ac-fix-rss.yml5
-rw-r--r--internal/supervisor/monitor.go4
-rw-r--r--internal/supervisor/monitor_test.go13
3 files changed, 20 insertions, 2 deletions
diff --git a/changelogs/unreleased/ac-fix-rss.yml b/changelogs/unreleased/ac-fix-rss.yml
new file mode 100644
index 000000000..c874e4cd2
--- /dev/null
+++ b/changelogs/unreleased/ac-fix-rss.yml
@@ -0,0 +1,5 @@
+---
+title: Fix RSS monitoring
+merge_request: 1257
+author:
+type: fixed
diff --git a/internal/supervisor/monitor.go b/internal/supervisor/monitor.go
index 4544e259a..1be009638 100644
--- a/internal/supervisor/monitor.go
+++ b/internal/supervisor/monitor.go
@@ -3,11 +3,11 @@ package supervisor
import (
"os/exec"
"strconv"
+ "strings"
"time"
"github.com/prometheus/client_golang/prometheus"
log "github.com/sirupsen/logrus"
- "gitlab.com/gitlab-org/gitaly/internal/helper/text"
)
var (
@@ -82,7 +82,7 @@ func getRss(pid int) int {
return 0
}
- rss, err := strconv.Atoi(text.ChompBytes(psRss))
+ rss, err := strconv.Atoi(strings.TrimSpace(string(psRss)))
if err != nil {
return 0
}
diff --git a/internal/supervisor/monitor_test.go b/internal/supervisor/monitor_test.go
new file mode 100644
index 000000000..8b78aaf8a
--- /dev/null
+++ b/internal/supervisor/monitor_test.go
@@ -0,0 +1,13 @@
+package supervisor
+
+import (
+ "os"
+ "testing"
+
+ "github.com/stretchr/testify/require"
+)
+
+func TestGetRss(t *testing.T) {
+ rss := getRss(os.Getpid())
+ require.True(t, rss > 0, "Expected a positive RSS")
+}