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:
authorJohn Cai <jcai@gitlab.com>2022-06-13 19:46:28 +0300
committerJohn Cai <jcai@gitlab.com>2022-06-13 19:47:27 +0300
commiteb53b19013c43dc8036cfd1be02e1171ac573931 (patch)
tree16ec11cf61e7c11d05d57cee5dc762d51a0dff22
parentd3a6e8e32f9a3f8123aac80c24ea9c3cbeca209c (diff)
cgroups: Add config value for enabling metricsjc-fix-cgroup-metric-types
-rw-r--r--internal/cgroups/v1_linux.go4
-rw-r--r--internal/gitaly/config/cgroups/cgroups.go3
2 files changed, 6 insertions, 1 deletions
diff --git a/internal/cgroups/v1_linux.go b/internal/cgroups/v1_linux.go
index a4f2b8483..0e660bab7 100644
--- a/internal/cgroups/v1_linux.go
+++ b/internal/cgroups/v1_linux.go
@@ -135,6 +135,10 @@ func (cg *CGroupV1Manager) addToCgroup(pid int, cgroupPath string) error {
// Collect collects metrics from the cgroups controller
func (cg *CGroupV1Manager) Collect(ch chan<- prometheus.Metric) {
+ if !cg.cfg.MetricsEnabled {
+ return
+ }
+
for i := 0; i < int(cg.cfg.Repositories.Count); i++ {
repoPath := cg.repoPath(i)
logger := log.Default().WithField("cgroup_path", repoPath)
diff --git a/internal/gitaly/config/cgroups/cgroups.go b/internal/gitaly/config/cgroups/cgroups.go
index 935a1a565..8d9094552 100644
--- a/internal/gitaly/config/cgroups/cgroups.go
+++ b/internal/gitaly/config/cgroups/cgroups.go
@@ -14,7 +14,8 @@ type Config struct {
MemoryBytes int64 `toml:"memory_bytes"`
// CPUShares are the shares of CPU the parent cgroup is allowed to utilize. A value of 1024
// is full utilization of the CPU. 0 implies no CPU limit.
- CPUShares uint64 `toml:"cpu_shares"`
+ CPUShares uint64 `toml:"cpu_shares"`
+ MetricsEnabled bool `toml:"metrics_enabled"`
// Deprecated: No longer supported after 15.0
Count uint `toml:"count"`