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
99391e80
Commit
99391e80
authored
Feb 02, 2021
by
Aleksei Lipniagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move CleanupMultiprocDirService out of config.ru
parent
c89d94e5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
25 deletions
+29
-25
changelogs/unreleased/300652-fix-prom-metrics-in-puma-single.yml
...ogs/unreleased/300652-fix-prom-metrics-in-puma-single.yml
+5
-0
config.ru
config.ru
+0
-6
config/initializers/7_prometheus_metrics.rb
config/initializers/7_prometheus_metrics.rb
+24
-19
No files found.
changelogs/unreleased/300652-fix-prom-metrics-in-puma-single.yml
0 → 100644
View file @
99391e80
---
title
:
Move CleanupMultiprocDirService out of config.ru
merge_request
:
53139
author
:
type
:
other
config.ru
View file @
99391e80
...
@@ -22,12 +22,6 @@ def master_process?
...
@@ -22,12 +22,6 @@ def master_process?
end
end
warmup
do
|
app
|
warmup
do
|
app
|
# The following is necessary to ensure stale Prometheus metrics don't accumulate over time.
# It needs to be done as early as here to ensure metrics files aren't deleted.
# After we hit our app in `warmup`, first metrics and corresponding files already being created,
# for example in `lib/gitlab/metrics/requests_rack_middleware.rb`.
Prometheus
::
CleanupMultiprocDirService
.
new
.
execute
if
master_process?
client
=
Rack
::
MockRequest
.
new
(
app
)
client
=
Rack
::
MockRequest
.
new
(
app
)
client
.
get
(
'/'
)
client
.
get
(
'/'
)
end
end
...
...
config/initializers/7_prometheus_metrics.rb
View file @
99391e80
...
@@ -39,19 +39,24 @@ Sidekiq.configure_server do |config|
...
@@ -39,19 +39,24 @@ Sidekiq.configure_server do |config|
end
end
if
!
Rails
.
env
.
test?
&&
Gitlab
::
Metrics
.
prometheus_metrics_enabled?
if
!
Rails
.
env
.
test?
&&
Gitlab
::
Metrics
.
prometheus_metrics_enabled?
Gitlab
::
Cluster
::
LifecycleEvents
.
on_worker_start
do
# When running Puma in a Single mode, `on_master_start` and `on_worker_start` are the same.
defined?
(
::
Prometheus
::
Client
.
reinitialize_on_pid_change
)
&&
Prometheus
::
Client
.
reinitialize_on_pid_change
# Thus, we order these events to run `reinitialize_on_pid_change` with `force: true` first.
Gitlab
::
Cluster
::
LifecycleEvents
.
on_master_start
do
# Ensure that stale Prometheus metrics don't accumulate over time
Prometheus
::
CleanupMultiprocDirService
.
new
.
execute
Gitlab
::
Metrics
::
Samplers
::
RubySampler
.
initialize_instance
.
start
::
Prometheus
::
Client
.
reinitialize_on_pid_change
(
force:
true
)
Gitlab
::
Metrics
::
Samplers
::
DatabaseSampler
.
initialize_instance
.
start
Gitlab
::
Metrics
::
Samplers
::
ThreadsSampler
.
initialize_instance
.
start
if
Gitlab
::
Runtime
.
action_cable?
if
Gitlab
::
Runtime
.
unicorn?
Gitlab
::
Metrics
::
Samplers
::
ActionCableSampler
.
instance
.
start
Gitlab
::
Metrics
::
Samplers
::
UnicornSampler
.
instance
(
Settings
.
monitoring
.
unicorn_sampler_interval
).
start
elsif
Gitlab
::
Runtime
.
puma?
Gitlab
::
Metrics
::
Samplers
::
PumaSampler
.
instance
.
start
end
end
if
Gitlab
.
ee?
&&
Gitlab
::
Runtime
.
sidekiq?
Gitlab
::
Metrics
.
gauge
(
:deployments
,
'GitLab Version'
,
{},
:max
).
set
({
version:
Gitlab
::
VERSION
},
1
)
Gitlab
::
Metrics
::
Samplers
::
GlobalSearchSampler
.
instance
.
start
unless
Gitlab
::
Runtime
.
sidekiq?
Gitlab
::
Metrics
::
RequestsRackMiddleware
.
initialize_metrics
end
end
Gitlab
::
Ci
::
Parsers
.
instrument!
Gitlab
::
Ci
::
Parsers
.
instrument!
...
@@ -60,19 +65,19 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled?
...
@@ -60,19 +65,19 @@ if !Rails.env.test? && Gitlab::Metrics.prometheus_metrics_enabled?
Gitlab
::
Metrics
.
error_detected!
Gitlab
::
Metrics
.
error_detected!
end
end
Gitlab
::
Cluster
::
LifecycleEvents
.
on_
mast
er_start
do
Gitlab
::
Cluster
::
LifecycleEvents
.
on_
work
er_start
do
::
Prometheus
::
Client
.
reinitialize_on_pid_change
(
force:
true
)
defined?
(
::
Prometheus
::
Client
.
reinitialize_on_pid_change
)
&&
Prometheus
::
Client
.
reinitialize_on_pid_change
if
Gitlab
::
Runtime
.
unicorn?
Gitlab
::
Metrics
::
Samplers
::
RubySampler
.
initialize_instance
.
start
Gitlab
::
Metrics
::
Samplers
::
UnicornSampler
.
instance
(
Settings
.
monitoring
.
unicorn_sampler_interval
).
start
Gitlab
::
Metrics
::
Samplers
::
DatabaseSampler
.
initialize_instance
.
start
elsif
Gitlab
::
Runtime
.
puma?
Gitlab
::
Metrics
::
Samplers
::
ThreadsSampler
.
initialize_instance
.
start
Gitlab
::
Metrics
::
Samplers
::
PumaSampler
.
instance
.
start
end
Gitlab
::
Metrics
.
gauge
(
:deployments
,
'GitLab Version'
,
{},
:max
).
set
({
version:
Gitlab
::
VERSION
},
1
)
if
Gitlab
::
Runtime
.
action_cable?
Gitlab
::
Metrics
::
Samplers
::
ActionCableSampler
.
instance
.
start
end
unless
Gitlab
::
Runtime
.
sidekiq?
if
Gitlab
.
ee?
&&
Gitlab
::
Runtime
.
sidekiq?
Gitlab
::
Metrics
::
RequestsRackMiddleware
.
initialize_metrics
Gitlab
::
Metrics
::
Samplers
::
GlobalSearchSampler
.
instance
.
start
end
end
Gitlab
::
Ci
::
Parsers
.
instrument!
Gitlab
::
Ci
::
Parsers
.
instrument!
...
...
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