gitlab-org--gitlab-foss/app/helpers/sidekiq_helper.rb

16 lines
368 B
Ruby
Raw Normal View History

2016-09-06 15:40:49 -04:00
module SidekiqHelper
SIDEKIQ_PS_REGEXP = /\A
2016-09-08 13:41:25 -04:00
(?<pid>\d+)\s+
(?<cpu>[\d\.,]+)\s+
(?<mem>[\d\.,]+)\s+
(?<state>[DIEKNRSTVWXZNLpsl\+<>\/\d]+)\s+
(?<start>.+?)\s+
(?<command>(?:ruby\d+:\s+)?sidekiq.*\].*)
2016-09-08 13:41:25 -04:00
\z/x
2016-09-06 15:40:49 -04:00
def parse_sidekiq_ps(line)
match = line.strip.match(SIDEKIQ_PS_REGEXP)
match ? match[1..6] : Array.new(6, '?')
2016-09-06 15:40:49 -04:00
end
end