debian-mirror-gitlab/app/helpers/sidekiq_helper.rb

16 lines
368 B
Ruby
Raw Normal View History

2016-09-29 09:46:39 +05:30
module SidekiqHelper
SIDEKIQ_PS_REGEXP = /\A
(?<pid>\d+)\s+
(?<cpu>[\d\.,]+)\s+
(?<mem>[\d\.,]+)\s+
2017-08-17 22:00:37 +05:30
(?<state>[DIEKNRSTVWXZNLpsl\+<>\/\d]+)\s+
(?<start>.+?)\s+
(?<command>(?:ruby\d+:\s+)?sidekiq.*\].*)
2016-09-29 09:46:39 +05:30
\z/x
def parse_sidekiq_ps(line)
2017-08-17 22:00:37 +05:30
match = line.strip.match(SIDEKIQ_PS_REGEXP)
match ? match[1..6] : Array.new(6, '?')
2016-09-29 09:46:39 +05:30
end
end