Commit 189194b3 authored by Ahmad Sherif's avatar Ahmad Sherif
Browse files

Count git process count manually

parent 93d3e26e
Pipeline #23616 passed with stage
in 1 minute and 33 seconds
PATH
remote: .
specs:
gitlab-monitor (0.0.15)
gitlab-monitor (0.0.16)
pg (~> 0.18.4)
quantile (~> 0.2.0)
redis-namespace (~> 1.5.2)
......
......@@ -91,14 +91,19 @@ module GitLab
end
def probe_git # rubocop:disable Metrics/MethodLength
counts = Hash.new(0)
Utils.pgrep("^git ").each do |pid|
process_cmd = File.read("/proc/#{pid}/cmdline")
subcommand = self.class.extract_subcommand(process_cmd)
next unless subcommand # Unlikely, but just to be safe
name = "git #{subcommand}"
counts[name] += 1
prober = ProcessProber.new(
{
name: "git #{subcommand}",
name: name,
pid_or_pattern: pid,
quantiles: @opts[:quantiles]
},
......@@ -108,7 +113,10 @@ module GitLab
prober
.probe_memory
.probe_age
.probe_count
end
counts.each do |name, count|
@metrics.add("process_count", count, name: name)
end
self
......
module GitLab
module Monitor
VERSION = "0.0.15".freeze
VERSION = "0.0.16".freeze
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment