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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
61220afa
Commit
61220afa
authored
Jun 10, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
51fbdb3b
65be6f1a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
2 deletions
+56
-2
config/puma.example.development.rb
config/puma.example.development.rb
+0
-1
doc/administration/monitoring/prometheus/gitlab_metrics.md
doc/administration/monitoring/prometheus/gitlab_metrics.md
+1
-0
lib/gitlab/cluster/puma_worker_killer_initializer.rb
lib/gitlab/cluster/puma_worker_killer_initializer.rb
+3
-0
lib/gitlab/cluster/puma_worker_killer_observer.rb
lib/gitlab/cluster/puma_worker_killer_observer.rb
+24
-0
spec/lib/gitlab/cluster/puma_worker_killer_observer_spec.rb
spec/lib/gitlab/cluster/puma_worker_killer_observer_spec.rb
+27
-0
spec/rack_servers/puma_spec.rb
spec/rack_servers/puma_spec.rb
+1
-1
No files found.
config/puma.example.development.rb
View file @
61220afa
...
...
@@ -42,7 +42,6 @@ bind 'unix:///home/git/gitlab.socket'
workers
2
require_relative
"/home/git/gitlab/lib/gitlab/cluster/lifecycle_events"
require_relative
"/home/git/gitlab/lib/gitlab/cluster/puma_worker_killer_initializer"
on_restart
do
# Signal application hooks that we're about to restart
...
...
doc/administration/monitoring/prometheus/gitlab_metrics.md
View file @
61220afa
...
...
@@ -125,6 +125,7 @@ When Puma is used instead of Unicorn, following metrics are available:
| puma_max_threads | Gauge | 12.0 | Maximum number of worker threads |
| puma_idle_threads | Gauge | 12.0 | Number of spawned threads which are not processing a request |
| rack_state_total | Gauge | 12.0 | Number of requests in a given rack state |
| puma_killer_terminations_total | Gauge | 12.0 | Number of workers terminated by PumaWorkerKiller |
## Metrics shared directory
...
...
lib/gitlab/cluster/puma_worker_killer_initializer.rb
View file @
61220afa
...
...
@@ -27,6 +27,9 @@ module Gitlab
# is restarted already, thus periodically restarting workers shouldn't be
# needed.
config
.
rolling_restart_frequency
=
false
observer
=
Gitlab
::
Cluster
::
PumaWorkerKillerObserver
.
new
config
.
pre_term
=
observer
.
callback
end
PumaWorkerKiller
.
start
...
...
lib/gitlab/cluster/puma_worker_killer_observer.rb
0 → 100644
View file @
61220afa
# frozen_string_literal: true
module
Gitlab
module
Cluster
class
PumaWorkerKillerObserver
def
initialize
@counter
=
Gitlab
::
Metrics
.
counter
(
:puma_killer_terminations_total
,
'Number of workers terminated by PumaWorkerKiller'
)
end
# returns the Proc to be used as the observer callback block
def
callback
method
(
:log_termination
)
end
private
def
log_termination
(
worker
)
labels
=
{
worker:
"worker_
#{
worker
.
index
}
"
}
@counter
.
increment
(
labels
)
end
end
end
end
spec/lib/gitlab/cluster/puma_worker_killer_observer_spec.rb
0 → 100644
View file @
61220afa
# frozen_string_literal: true
require
'spec_helper'
describe
Gitlab
::
Cluster
::
PumaWorkerKillerObserver
do
let
(
:counter
)
{
Gitlab
::
Metrics
::
NullMetric
.
instance
}
before
do
allow
(
Gitlab
::
Metrics
).
to
receive
(
:counter
)
.
with
(
any_args
)
.
and_return
(
counter
)
end
describe
'#callback'
do
subject
{
described_class
.
new
}
it
'increments timeout counter'
do
worker
=
double
(
index:
0
)
expect
(
counter
)
.
to
receive
(
:increment
)
.
with
({
worker:
'worker_0'
})
subject
.
callback
.
call
(
worker
)
end
end
end
spec/rack_servers/puma_spec.rb
View file @
61220afa
...
...
@@ -20,7 +20,7 @@ describe 'Puma' do
File
.
write
(
config_path
,
config_lines
)
cmd
=
%W[puma -e test -C
#{
config_path
}
#{
File
.
join
(
__dir__
,
'configs/config.ru'
)
}
]
@puma_master_pid
=
spawn
(
*
cmd
)
@puma_master_pid
=
spawn
(
{
'DISABLE_PUMA_WORKER_KILLER'
=>
'1'
},
*
cmd
)
wait_puma_boot!
(
@puma_master_pid
,
File
.
join
(
project_root
,
'tmp/tests/puma-worker-ready'
))
WebMock
.
allow_net_connect!
end
...
...
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