gitlab-org--gitlab-foss/app/helpers/sidekiq_helper.rb
Sebastian Reitenbach fd097fa9e1 Handle parsing OpenBSD ps output properly to display sidekiq
infos on admin->monitoring->background
2017-03-31 09:45:46 +02:00

15 lines
368 B
Ruby

module SidekiqHelper
SIDEKIQ_PS_REGEXP = /\A
(?<pid>\d+)\s+
(?<cpu>[\d\.,]+)\s+
(?<mem>[\d\.,]+)\s+
(?<state>[DIEKNRSTVWXZNLpsl\+<>\/\d]+)\s+
(?<start>.+?)\s+
(?<command>(?:ruby\d+:\s+)?sidekiq.*\].*)
\z/x
def parse_sidekiq_ps(line)
match = line.strip.match(SIDEKIQ_PS_REGEXP)
match ? match[1..6] : Array.new(6, '?')
end
end