BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
fd097fa9
Commit
fd097fa9
authored
Mar 28, 2017
by
Sebastian Reitenbach
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle parsing OpenBSD ps output properly to display sidekiq
infos on admin->monitoring->background
parent
bcb0a554
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
4 deletions
+16
-4
background_jobs_controller.rb
app/controllers/admin/background_jobs_controller.rb
+1
-1
sidekiq_helper.rb
app/helpers/sidekiq_helper.rb
+3
-3
fix_admin_monitoring_background.yml
changelogs/unreleased/fix_admin_monitoring_background.yml
+4
-0
sidekiq_helper_spec.rb
spec/helpers/sidekiq_helper_spec.rb
+8
-0
No files found.
app/controllers/admin/background_jobs_controller.rb
View file @
fd097fa9
class
Admin
::
BackgroundJobsController
<
Admin
::
ApplicationController
def
show
ps_output
,
_
=
Gitlab
::
Popen
.
popen
(
%W(ps ww -U
#{
Gitlab
.
config
.
gitlab
.
user
}
-o pid,pcpu,pmem,stat,start,command)
)
@sidekiq_processes
=
ps_output
.
split
(
"
\n
"
).
grep
(
/sidekiq/
)
@sidekiq_processes
=
ps_output
.
split
(
"
\n
"
).
grep
(
/sidekiq
\d+\.\d+\.\d+
/
)
@concurrency
=
Sidekiq
.
options
[
:concurrency
]
end
end
app/helpers/sidekiq_helper.rb
View file @
fd097fa9
...
...
@@ -3,9 +3,9 @@ module SidekiqHelper
(?<pid>\d+)\s+
(?<cpu>[\d\.,]+)\s+
(?<mem>[\d\.,]+)\s+
(?<state>[D
RSTWXZNLsl\+<
]+)\s+
(?<start>.+)\s+
(?<command>
sidekiq.*\]
)
(?<state>[D
IEKNRSTVWXZNLpsl\+<>\/\d
]+)\s+
(?<start>.+
?
)\s+
(?<command>
(?:ruby\d+:\s+)?sidekiq.*\].*
)
\z/x
def
parse_sidekiq_ps
(
line
)
...
...
changelogs/unreleased/fix_admin_monitoring_background.yml
0 → 100644
View file @
fd097fa9
---
title
:
Handle parsing OpenBSD ps output properly to display sidekiq infos on admin->monitoring->background
merge_request
:
10303
author
:
Sebastian Reitenbach
spec/helpers/sidekiq_helper_spec.rb
View file @
fd097fa9
...
...
@@ -53,6 +53,14 @@ describe SidekiqHelper do
expect
(
parts
).
to
eq
([
'17725'
,
'1.0'
,
'12.1'
,
'Ssl'
,
'19:20:15'
,
'sidekiq 4.2.1 gitlab-rails [0 of 25 busy]'
])
end
it
'parses OpenBSD output'
do
# OpenBSD 6.1
line
=
'49258 0.5 2.3 R/0 Fri10PM ruby23: sidekiq 4.2.7 gitlab [0 of 25 busy] (ruby23)'
parts
=
helper
.
parse_sidekiq_ps
(
line
)
expect
(
parts
).
to
eq
([
'49258'
,
'0.5'
,
'2.3'
,
'R/0'
,
'Fri10PM'
,
'ruby23: sidekiq 4.2.7 gitlab [0 of 25 busy] (ruby23)'
])
end
it
'does fail gracefully on line not matching the format'
do
line
=
'55137 10.0 2.1 S+ 2:30pm something'
parts
=
helper
.
parse_sidekiq_ps
(
line
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment