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
c10d55a6
Commit
c10d55a6
authored
May 19, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use only ENV for metrics folder location
parent
67269228
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
15 deletions
+12
-15
app/controllers/metrics_controller.rb
app/controllers/metrics_controller.rb
+6
-2
config.ru
config.ru
+2
-3
config/gitlab.yml.example
config/gitlab.yml.example
+0
-5
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+0
-1
config/routes.rb
config/routes.rb
+4
-4
No files found.
app/controllers/metrics_controller.rb
View file @
c10d55a6
...
@@ -11,9 +11,9 @@ class MetricsController < ActionController::Base
...
@@ -11,9 +11,9 @@ class MetricsController < ActionController::Base
].
freeze
].
freeze
def
metrics
def
metrics
render_404
unless
Gitlab
::
Metrics
.
prometheus_metrics_enabled?
re
turn
re
nder_404
unless
Gitlab
::
Metrics
.
prometheus_metrics_enabled?
metrics_text
=
Prometheus
::
Client
::
Formats
::
Text
.
marshal_multiprocess
(
Settings
.
gitlab
[
'prometheus_multiproc_dir'
]
)
metrics_text
=
Prometheus
::
Client
::
Formats
::
Text
.
marshal_multiprocess
(
multiprocess_metrics_path
)
response
=
health_metrics_text
+
"
\n
"
+
metrics_text
response
=
health_metrics_text
+
"
\n
"
+
metrics_text
render
text:
response
,
content_type:
'text/plain; version=0.0.4'
render
text:
response
,
content_type:
'text/plain; version=0.0.4'
...
@@ -21,6 +21,10 @@ class MetricsController < ActionController::Base
...
@@ -21,6 +21,10 @@ class MetricsController < ActionController::Base
private
private
def
multiprocess_metrics_path
Rails
.
root
.
join
(
ENV
[
'prometheus_multiproc_dir'
])
end
def
health_metrics_text
def
health_metrics_text
results
=
CHECKS
.
flat_map
(
&
:metrics
)
results
=
CHECKS
.
flat_map
(
&
:metrics
)
...
...
config.ru
View file @
c10d55a6
...
@@ -13,10 +13,9 @@ if defined?(Unicorn)
...
@@ -13,10 +13,9 @@ if defined?(Unicorn)
# Max memory size (RSS) per worker
# Max memory size (RSS) per worker
use
Unicorn
::
WorkerKiller
::
Oom
,
min
,
max
use
Unicorn
::
WorkerKiller
::
Oom
,
min
,
max
end
end
# TODO(lyda): Needs to be set externally.
ENV
[
'prometheus_multiproc_dir'
]
=
'/tmp/somestuff'
end
end
# set default for multiproces metrics gathering
ENV
[
'prometheus_multiproc_dir'
]
||=
'tmp/prometheus_data_dir'
require
::
File
.
expand_path
(
'../config/environment'
,
__FILE__
)
require
::
File
.
expand_path
(
'../config/environment'
,
__FILE__
)
...
...
config/gitlab.yml.example
View file @
c10d55a6
...
@@ -102,11 +102,6 @@ production: &base
...
@@ -102,11 +102,6 @@ production: &base
# The default is 'shared/cache/archive/' relative to the root of the Rails app.
# The default is 'shared/cache/archive/' relative to the root of the Rails app.
# repository_downloads_path: shared/cache/archive/
# repository_downloads_path: shared/cache/archive/
## Prometheus Client Data directory
# To be used efficiently in multiprocess Ruby setup like Unicorn, Prometheus client needs to share metrics with other instances.
# The default is 'tmp/prometheus_data_dir' relative to Rails.root
# prometheus_multiproc_dir: tmp/prometheus_data_dir
## Reply by email
## Reply by email
# Allow users to comment on issues and merge requests by replying to notification emails.
# Allow users to comment on issues and merge requests by replying to notification emails.
# For documentation on how to set this up, see http://doc.gitlab.com/ce/administration/reply_by_email.html
# For documentation on how to set this up, see http://doc.gitlab.com/ce/administration/reply_by_email.html
...
...
config/initializers/1_settings.rb
View file @
c10d55a6
...
@@ -242,7 +242,6 @@ Settings.gitlab['import_sources'] ||= %w[github bitbucket gitlab google_code fog
...
@@ -242,7 +242,6 @@ Settings.gitlab['import_sources'] ||= %w[github bitbucket gitlab google_code fog
Settings
.
gitlab
[
'trusted_proxies'
]
||=
[]
Settings
.
gitlab
[
'trusted_proxies'
]
||=
[]
Settings
.
gitlab
[
'no_todos_messages'
]
||=
YAML
.
load_file
(
Rails
.
root
.
join
(
'config'
,
'no_todos_messages.yml'
))
Settings
.
gitlab
[
'no_todos_messages'
]
||=
YAML
.
load_file
(
Rails
.
root
.
join
(
'config'
,
'no_todos_messages.yml'
))
Settings
.
gitlab
[
'usage_ping_enabled'
]
=
true
if
Settings
.
gitlab
[
'usage_ping_enabled'
].
nil?
Settings
.
gitlab
[
'usage_ping_enabled'
]
=
true
if
Settings
.
gitlab
[
'usage_ping_enabled'
].
nil?
Settings
.
gitlab
[
'prometheus_multiproc_dir'
]
||=
ENV
[
'prometheus_multiproc_dir'
]
||
'tmp/prometheus_data_dir'
#
#
# CI
# CI
...
...
config/routes.rb
View file @
c10d55a6
...
@@ -38,10 +38,10 @@ Rails.application.routes.draw do
...
@@ -38,10 +38,10 @@ Rails.application.routes.draw do
# Health check
# Health check
get
'health_check(/:checks)'
=>
'health_check#index'
,
as: :health_check
get
'health_check(/:checks)'
=>
'health_check#index'
,
as: :health_check
scope
path:
'-'
,
controller:
'health'
do
scope
path:
'-'
do
get
:liveness
get
'liveness'
=>
'health#liveness'
get
:readiness
get
'readiness'
=>
'health#readiness'
get
:metrics
get
'metrics'
=>
'metrics#metrics'
end
end
# Koding route
# Koding route
...
...
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