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
Jérome Perrin
gitlab-ce
Commits
b1ba8eb9
Commit
b1ba8eb9
authored
Jan 22, 2018
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use include Gitlab::CurrentSettings unnecessarily
parent
1ac96603
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
lib/gitlab/metrics/influx_db.rb
lib/gitlab/metrics/influx_db.rb
+13
-11
lib/gitlab/metrics/prometheus.rb
lib/gitlab/metrics/prometheus.rb
+2
-2
No files found.
lib/gitlab/metrics/influx_db.rb
View file @
b1ba8eb9
...
...
@@ -13,8 +13,6 @@ module Gitlab
private_constant
:MUTEX
class_methods
do
include
Gitlab
::
CurrentSettings
def
influx_metrics_enabled?
settings
[
:enabled
]
||
false
end
...
...
@@ -22,17 +20,21 @@ module Gitlab
# Prometheus histogram buckets used for arbitrary code measurements
def
settings
@settings
||=
{
enabled:
current_application_settings
[
:metrics_enabled
],
pool_size:
current_application_settings
[
:metrics_pool_size
],
timeout:
current_application_settings
[
:metrics_timeout
],
method_call_threshold:
current_application_settings
[
:metrics_method_call_threshold
],
host:
current_application_settings
[
:metrics_host
],
port:
current_application_settings
[
:metrics_port
],
sample_interval:
current_application_settings
[
:metrics_sample_interval
]
||
15
,
packet_size:
current_application_settings
[
:metrics_packet_size
]
||
1
@settings
||=
begin
current_settings
=
Gitlab
::
CurrentSettings
.
current_application_settings
{
enabled:
current_settings
[
:metrics_enabled
],
pool_size:
current_settings
[
:metrics_pool_size
],
timeout:
current_settings
[
:metrics_timeout
],
method_call_threshold:
current_settings
[
:metrics_method_call_threshold
],
host:
current_settings
[
:metrics_host
],
port:
current_settings
[
:metrics_port
],
sample_interval:
current_settings
[
:metrics_sample_interval
]
||
15
,
packet_size:
current_settings
[
:metrics_packet_size
]
||
1
}
end
end
def
mri?
RUBY_ENGINE
==
'ruby'
...
...
lib/gitlab/metrics/prometheus.rb
View file @
b1ba8eb9
...
...
@@ -9,7 +9,6 @@ module Gitlab
PROVIDER_MUTEX
=
Mutex
.
new
class_methods
do
include
Gitlab
::
CurrentSettings
include
Gitlab
::
Utils
::
StrongMemoize
def
metrics_folder_present?
...
...
@@ -72,7 +71,8 @@ module Gitlab
end
def
prometheus_metrics_enabled_unmemoized
metrics_folder_present?
&&
current_application_settings
[
:prometheus_metrics_enabled
]
||
false
metrics_folder_present?
&&
Gitlab
::
CurrentSettings
.
current_application_settings
[
:prometheus_metrics_enabled
]
||
false
end
end
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