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
d0c0c75c
Commit
d0c0c75c
authored
Nov 23, 2016
by
Robert Speicher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fix_sidekiq_stats_in_admin_area' into 'master'
Fix Sidekiq stats in admin area Closes #23825, #24675 See merge request !7654
parents
536ec509
40822b61
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
7 deletions
+30
-7
sidekiq_helper.rb
app/helpers/sidekiq_helper.rb
+3
-7
fix_sidekiq_stats_in_admin_area.yml
changelogs/unreleased/fix_sidekiq_stats_in_admin_area.yml
+4
-0
sidekiq_helper_spec.rb
spec/helpers/sidekiq_helper_spec.rb
+23
-0
No files found.
app/helpers/sidekiq_helper.rb
View file @
d0c0c75c
...
...
@@ -5,15 +5,11 @@ module SidekiqHelper
(?<mem>[\d\.,]+)\s+
(?<state>[DRSTWXZNLsl\+<]+)\s+
(?<start>.+)\s+
(?<command>sidekiq.*\])
\s*
(?<command>sidekiq.*\])
\z/x
def
parse_sidekiq_ps
(
line
)
match
=
line
.
match
(
SIDEKIQ_PS_REGEXP
)
if
match
match
[
1
..
6
]
else
%w[? ? ? ? ? ?]
end
match
=
line
.
strip
.
match
(
SIDEKIQ_PS_REGEXP
)
match
?
match
[
1
..
6
]
:
Array
.
new
(
6
,
'?'
)
end
end
changelogs/unreleased/fix_sidekiq_stats_in_admin_area.yml
0 → 100644
View file @
d0c0c75c
---
title
:
Sidekiq stats in the admin area will now show correctly on different platforms
merge_request
:
author
:
blackst0ne
spec/helpers/sidekiq_helper_spec.rb
View file @
d0c0c75c
...
...
@@ -30,6 +30,29 @@ describe SidekiqHelper do
expect
(
parts
).
to
eq
([
'55137'
,
'10.0'
,
'2.1'
,
'S+'
,
'2:30pm'
,
'sidekiq 4.1.4 gitlab [0 of 25 busy]'
])
end
it
'parses OSX output'
do
line
=
' 1641 1.5 3.8 S+ 4:04PM sidekiq 4.2.1 gitlab [0 of 25 busy]'
parts
=
helper
.
parse_sidekiq_ps
(
line
)
expect
(
parts
).
to
eq
([
'1641'
,
'1.5'
,
'3.8'
,
'S+'
,
'4:04PM'
,
'sidekiq 4.2.1 gitlab [0 of 25 busy]'
])
end
it
'parses Ubuntu output'
do
# Ubuntu Linux 16.04 LTS / procps-3.3.10-4ubuntu2
line
=
' 938 1.4 2.5 Sl+ 21:23:21 sidekiq 4.2.1 gitlab [0 of 25 busy] '
parts
=
helper
.
parse_sidekiq_ps
(
line
)
expect
(
parts
).
to
eq
([
'938'
,
'1.4'
,
'2.5'
,
'Sl+'
,
'21:23:21'
,
'sidekiq 4.2.1 gitlab [0 of 25 busy]'
])
end
it
'parses Debian output'
do
# Debian Linux Wheezy/Jessie
line
=
'17725 1.0 12.1 Ssl 19:20:15 sidekiq 4.2.1 gitlab-rails [0 of 25 busy] '
parts
=
helper
.
parse_sidekiq_ps
(
line
)
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
'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