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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
406 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2016-09-06 19:40:49 +00:00
module SidekiqHelper
2018-01-27 05:35:53 +00:00
SIDEKIQ_PS_REGEXP = %r{\A
2016-09-08 17:41:25 +00:00
(?<pid>\d+)\s+
(?<cpu>[\d\.,]+)\s+
(?<mem>[\d\.,]+)\s+
(?<state>[DIEKNRSTVWXZLpsl\+<>/\d]+)\s+
(?<start>.+?)\s+
(?<command>(?:ruby\d+:\s+)?sidekiq.*\].*)
2019-05-05 10:19:14 +00:00
\z}x.freeze
2016-09-06 19:40:49 +00:00
def parse_sidekiq_ps(line)
match = line.strip.match(SIDEKIQ_PS_REGEXP)
match ? match[1..6] : Array.new(6, '?')
2016-09-06 19:40:49 +00:00
end
end