gitlab-org--gitlab-foss/app/helpers/sidekiq_helper.rb
blackst0ne 40822b6185 Fix sidekiq stats in admin area
Added tests

Added changelog entry

Resolved all issues in code
2016-11-23 08:36:03 +11:00

15 lines
338 B
Ruby

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