Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
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
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
4 deletions
+16
-4
app/controllers/admin/background_jobs_controller.rb
app/controllers/admin/background_jobs_controller.rb
+1
-1
app/helpers/sidekiq_helper.rb
app/helpers/sidekiq_helper.rb
+3
-3
changelogs/unreleased/fix_admin_monitoring_background.yml
changelogs/unreleased/fix_admin_monitoring_background.yml
+4
-0
spec/helpers/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
class
Admin::BackgroundJobsController
<
Admin
::
ApplicationController
def
show
def
show
ps_output
,
_
=
Gitlab
::
Popen
.
popen
(
%W(ps ww -U
#{
Gitlab
.
config
.
gitlab
.
user
}
-o pid,pcpu,pmem,stat,start,command)
)
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
]
@concurrency
=
Sidekiq
.
options
[
:concurrency
]
end
end
end
end
app/helpers/sidekiq_helper.rb
View file @
fd097fa9
...
@@ -3,9 +3,9 @@ module SidekiqHelper
...
@@ -3,9 +3,9 @@ module SidekiqHelper
(?<pid>\d+)\s+
(?<pid>\d+)\s+
(?<cpu>[\d\.,]+)\s+
(?<cpu>[\d\.,]+)\s+
(?<mem>[\d\.,]+)\s+
(?<mem>[\d\.,]+)\s+
(?<state>[D
RSTWXZNLsl\+<
]+)\s+
(?<state>[D
IEKNRSTVWXZNLpsl\+<>\/\d
]+)\s+
(?<start>.+)\s+
(?<start>.+
?
)\s+
(?<command>
sidekiq.*\]
)
(?<command>
(?:ruby\d+:\s+)?sidekiq.*\].*
)
\z/x
\z/x
def
parse_sidekiq_ps
(
line
)
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
...
@@ -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]'
])
expect
(
parts
).
to
eq
([
'17725'
,
'1.0'
,
'12.1'
,
'Ssl'
,
'19:20:15'
,
'sidekiq 4.2.1 gitlab-rails [0 of 25 busy]'
])
end
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
it
'does fail gracefully on line not matching the format'
do
line
=
'55137 10.0 2.1 S+ 2:30pm something'
line
=
'55137 10.0 2.1 S+ 2:30pm something'
parts
=
helper
.
parse_sidekiq_ps
(
line
)
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