2016-09-06 19:40:49 +00:00
|
|
|
module SidekiqHelper
|
2016-09-08 13:30:16 +00:00
|
|
|
SIDEKIQ_PS_REGEXP = /\A
|
2016-09-08 17:41:25 +00:00
|
|
|
(?<pid>\d+)\s+
|
|
|
|
(?<cpu>[\d\.,]+)\s+
|
|
|
|
(?<mem>[\d\.,]+)\s+
|
2017-03-28 21:29:49 +00:00
|
|
|
(?<state>[DIEKNRSTVWXZNLpsl\+<>\/\d]+)\s+
|
|
|
|
(?<start>.+?)\s+
|
|
|
|
(?<command>(?:ruby\d+:\s+)?sidekiq.*\].*)
|
2016-09-08 17:41:25 +00:00
|
|
|
\z/x
|
2016-09-08 13:30:16 +00:00
|
|
|
|
2016-09-06 19:40:49 +00:00
|
|
|
def parse_sidekiq_ps(line)
|
2016-11-22 10:31:01 +00:00
|
|
|
match = line.strip.match(SIDEKIQ_PS_REGEXP)
|
|
|
|
match ? match[1..6] : Array.new(6, '?')
|
2016-09-06 19:40:49 +00:00
|
|
|
end
|
|
|
|
end
|