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
2056c7de
Commit
2056c7de
authored
Feb 14, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
9891ffac
e842df60
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
24 additions
and
24 deletions
+24
-24
app/workers/reactive_caching_worker.rb
app/workers/reactive_caching_worker.rb
+1
-1
lib/gitlab/metrics/instrumentation.rb
lib/gitlab/metrics/instrumentation.rb
+2
-2
lib/gitlab/metrics/method_call.rb
lib/gitlab/metrics/method_call.rb
+1
-1
lib/gitlab/metrics/methods.rb
lib/gitlab/metrics/methods.rb
+3
-3
lib/gitlab/metrics/requests_rack_middleware.rb
lib/gitlab/metrics/requests_rack_middleware.rb
+3
-3
lib/gitlab/metrics/samplers/influx_sampler.rb
lib/gitlab/metrics/samplers/influx_sampler.rb
+2
-2
lib/gitlab/metrics/samplers/ruby_sampler.rb
lib/gitlab/metrics/samplers/ruby_sampler.rb
+5
-5
lib/gitlab/metrics/samplers/unicorn_sampler.rb
lib/gitlab/metrics/samplers/unicorn_sampler.rb
+2
-2
lib/gitlab/metrics/sidekiq_metrics_exporter.rb
lib/gitlab/metrics/sidekiq_metrics_exporter.rb
+1
-1
lib/gitlab/metrics/subscribers/rails_cache.rb
lib/gitlab/metrics/subscribers/rails_cache.rb
+2
-2
lib/gitlab/metrics/transaction.rb
lib/gitlab/metrics/transaction.rb
+2
-2
No files found.
app/workers/reactive_caching_worker.rb
View file @
2056c7de
...
@@ -6,7 +6,7 @@ class ReactiveCachingWorker
...
@@ -6,7 +6,7 @@ class ReactiveCachingWorker
# rubocop: disable CodeReuse/ActiveRecord
# rubocop: disable CodeReuse/ActiveRecord
def
perform
(
class_name
,
id
,
*
args
)
def
perform
(
class_name
,
id
,
*
args
)
klass
=
begin
klass
=
begin
Kernel
.
const_get
(
class_name
)
class_name
.
constantize
rescue
NameError
rescue
NameError
nil
nil
end
end
...
...
lib/gitlab/metrics/instrumentation.rb
View file @
2056c7de
...
@@ -19,7 +19,7 @@ module Gitlab
...
@@ -19,7 +19,7 @@ module Gitlab
# Returns the name of the series to use for storing method calls.
# Returns the name of the series to use for storing method calls.
def
self
.
series
def
self
.
series
@series
||=
"
#{
Metrics
.
series_prefix
}
method_calls"
@series
||=
"
#{
::
Gitlab
::
Metrics
.
series_prefix
}
method_calls"
end
end
# Instruments a class method.
# Instruments a class method.
...
@@ -118,7 +118,7 @@ module Gitlab
...
@@ -118,7 +118,7 @@ module Gitlab
# mod - The module containing the method.
# mod - The module containing the method.
# name - The name of the method to instrument.
# name - The name of the method to instrument.
def
self
.
instrument
(
type
,
mod
,
name
)
def
self
.
instrument
(
type
,
mod
,
name
)
return
unless
Metrics
.
enabled?
return
unless
::
Gitlab
::
Metrics
.
enabled?
name
=
name
.
to_sym
name
=
name
.
to_sym
target
=
type
==
:instance
?
mod
:
mod
.
singleton_class
target
=
type
==
:instance
?
mod
:
mod
.
singleton_class
...
...
lib/gitlab/metrics/method_call.rb
View file @
2056c7de
...
@@ -65,7 +65,7 @@ module Gitlab
...
@@ -65,7 +65,7 @@ module Gitlab
# Returns true if the total runtime of this method exceeds the method call
# Returns true if the total runtime of this method exceeds the method call
# threshold.
# threshold.
def
above_threshold?
def
above_threshold?
real_time
.
in_milliseconds
>=
Metrics
.
method_call_threshold
real_time
.
in_milliseconds
>=
::
Gitlab
::
Metrics
.
method_call_threshold
end
end
end
end
end
end
...
...
lib/gitlab/metrics/methods.rb
View file @
2056c7de
...
@@ -58,11 +58,11 @@ module Gitlab
...
@@ -58,11 +58,11 @@ module Gitlab
def
build_metric!
(
type
,
name
,
options
)
def
build_metric!
(
type
,
name
,
options
)
case
type
case
type
when
:gauge
when
:gauge
Gitlab
::
Metrics
.
gauge
(
name
,
options
.
docstring
,
options
.
base_labels
,
options
.
multiprocess_mode
)
::
Gitlab
::
Metrics
.
gauge
(
name
,
options
.
docstring
,
options
.
base_labels
,
options
.
multiprocess_mode
)
when
:counter
when
:counter
Gitlab
::
Metrics
.
counter
(
name
,
options
.
docstring
,
options
.
base_labels
)
::
Gitlab
::
Metrics
.
counter
(
name
,
options
.
docstring
,
options
.
base_labels
)
when
:histogram
when
:histogram
Gitlab
::
Metrics
.
histogram
(
name
,
options
.
docstring
,
options
.
base_labels
,
options
.
buckets
)
::
Gitlab
::
Metrics
.
histogram
(
name
,
options
.
docstring
,
options
.
base_labels
,
options
.
buckets
)
when
:summary
when
:summary
raise
NotImplementedError
,
"summary metrics are not currently supported"
raise
NotImplementedError
,
"summary metrics are not currently supported"
else
else
...
...
lib/gitlab/metrics/requests_rack_middleware.rb
View file @
2056c7de
...
@@ -8,15 +8,15 @@ module Gitlab
...
@@ -8,15 +8,15 @@ module Gitlab
end
end
def
self
.
http_request_total
def
self
.
http_request_total
@http_request_total
||=
Gitlab
::
Metrics
.
counter
(
:http_requests_total
,
'Request count'
)
@http_request_total
||=
::
Gitlab
::
Metrics
.
counter
(
:http_requests_total
,
'Request count'
)
end
end
def
self
.
rack_uncaught_errors_count
def
self
.
rack_uncaught_errors_count
@rack_uncaught_errors_count
||=
Gitlab
::
Metrics
.
counter
(
:rack_uncaught_errors_total
,
'Request handling uncaught errors count'
)
@rack_uncaught_errors_count
||=
::
Gitlab
::
Metrics
.
counter
(
:rack_uncaught_errors_total
,
'Request handling uncaught errors count'
)
end
end
def
self
.
http_request_duration_seconds
def
self
.
http_request_duration_seconds
@http_request_duration_seconds
||=
Gitlab
::
Metrics
.
histogram
(
:http_request_duration_seconds
,
'Request handling execution time'
,
@http_request_duration_seconds
||=
::
Gitlab
::
Metrics
.
histogram
(
:http_request_duration_seconds
,
'Request handling execution time'
,
{},
[
0.05
,
0.1
,
0.25
,
0.5
,
0.7
,
1
,
2.5
,
5
,
10
,
25
])
{},
[
0.05
,
0.1
,
0.25
,
0.5
,
0.7
,
1
,
2.5
,
5
,
10
,
25
])
end
end
...
...
lib/gitlab/metrics/samplers/influx_sampler.rb
View file @
2056c7de
...
@@ -10,7 +10,7 @@ module Gitlab
...
@@ -10,7 +10,7 @@ module Gitlab
# statistics, etc.
# statistics, etc.
class
InfluxSampler
<
BaseSampler
class
InfluxSampler
<
BaseSampler
# interval - The sampling interval in seconds.
# interval - The sampling interval in seconds.
def
initialize
(
interval
=
Metrics
.
settings
[
:sample_interval
])
def
initialize
(
interval
=
::
Gitlab
::
Metrics
.
settings
[
:sample_interval
])
super
(
interval
)
super
(
interval
)
@last_step
=
nil
@last_step
=
nil
...
@@ -32,7 +32,7 @@ module Gitlab
...
@@ -32,7 +32,7 @@ module Gitlab
end
end
def
flush
def
flush
Metrics
.
submit_metrics
(
@metrics
.
map
(
&
:to_hash
))
::
Gitlab
::
Metrics
.
submit_metrics
(
@metrics
.
map
(
&
:to_hash
))
end
end
def
sample_memory_usage
def
sample_memory_usage
...
...
lib/gitlab/metrics/samplers/ruby_sampler.rb
View file @
2056c7de
...
@@ -24,14 +24,14 @@ module Gitlab
...
@@ -24,14 +24,14 @@ module Gitlab
def
init_metrics
def
init_metrics
metrics
=
{}
metrics
=
{}
metrics
[
:sampler_duration
]
=
Metrics
.
counter
(
with_prefix
(
:sampler
,
:duration_seconds_total
),
'Sampler time'
,
labels
)
metrics
[
:sampler_duration
]
=
::
Gitlab
::
Metrics
.
counter
(
with_prefix
(
:sampler
,
:duration_seconds_total
),
'Sampler time'
,
labels
)
metrics
[
:total_time
]
=
Metrics
.
counter
(
with_prefix
(
:gc
,
:duration_seconds_total
),
'Total GC time'
,
labels
)
metrics
[
:total_time
]
=
::
Gitlab
::
Metrics
.
counter
(
with_prefix
(
:gc
,
:duration_seconds_total
),
'Total GC time'
,
labels
)
GC
.
stat
.
keys
.
each
do
|
key
|
GC
.
stat
.
keys
.
each
do
|
key
|
metrics
[
key
]
=
Metrics
.
gauge
(
with_prefix
(
:gc_stat
,
key
),
to_doc_string
(
key
),
labels
,
:livesum
)
metrics
[
key
]
=
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:gc_stat
,
key
),
to_doc_string
(
key
),
labels
,
:livesum
)
end
end
metrics
[
:memory_usage
]
=
Metrics
.
gauge
(
with_prefix
(
:memory
,
:bytes
),
'Memory used'
,
labels
,
:livesum
)
metrics
[
:memory_usage
]
=
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:memory
,
:bytes
),
'Memory used'
,
labels
,
:livesum
)
metrics
[
:file_descriptors
]
=
Metrics
.
gauge
(
with_prefix
(
:file
,
:descriptors
),
'File descriptors used'
,
labels
,
:livesum
)
metrics
[
:file_descriptors
]
=
::
Gitlab
::
Metrics
.
gauge
(
with_prefix
(
:file
,
:descriptors
),
'File descriptors used'
,
labels
,
:livesum
)
metrics
metrics
end
end
...
...
lib/gitlab/metrics/samplers/unicorn_sampler.rb
View file @
2056c7de
...
@@ -9,11 +9,11 @@ module Gitlab
...
@@ -9,11 +9,11 @@ module Gitlab
end
end
def
unicorn_active_connections
def
unicorn_active_connections
@unicorn_active_connections
||=
Gitlab
::
Metrics
.
gauge
(
:unicorn_active_connections
,
'Unicorn active connections'
,
{},
:max
)
@unicorn_active_connections
||=
::
Gitlab
::
Metrics
.
gauge
(
:unicorn_active_connections
,
'Unicorn active connections'
,
{},
:max
)
end
end
def
unicorn_queued_connections
def
unicorn_queued_connections
@unicorn_queued_connections
||=
Gitlab
::
Metrics
.
gauge
(
:unicorn_queued_connections
,
'Unicorn queued connections'
,
{},
:max
)
@unicorn_queued_connections
||=
::
Gitlab
::
Metrics
.
gauge
(
:unicorn_queued_connections
,
'Unicorn queued connections'
,
{},
:max
)
end
end
def
enabled?
def
enabled?
...
...
lib/gitlab/metrics/sidekiq_metrics_exporter.rb
View file @
2056c7de
...
@@ -9,7 +9,7 @@ module Gitlab
...
@@ -9,7 +9,7 @@ module Gitlab
LOG_FILENAME
=
File
.
join
(
Rails
.
root
,
'log'
,
'sidekiq_exporter.log'
)
LOG_FILENAME
=
File
.
join
(
Rails
.
root
,
'log'
,
'sidekiq_exporter.log'
)
def
enabled?
def
enabled?
Gitlab
::
Metrics
.
metrics_folder_present?
&&
settings
.
enabled
::
Gitlab
::
Metrics
.
metrics_folder_present?
&&
settings
.
enabled
end
end
def
settings
def
settings
...
...
lib/gitlab/metrics/subscribers/rails_cache.rb
View file @
2056c7de
...
@@ -64,7 +64,7 @@ module Gitlab
...
@@ -64,7 +64,7 @@ module Gitlab
end
end
def
metric_cache_operation_duration_seconds
def
metric_cache_operation_duration_seconds
@metric_cache_operation_duration_seconds
||=
Gitlab
::
Metrics
.
histogram
(
@metric_cache_operation_duration_seconds
||=
::
Gitlab
::
Metrics
.
histogram
(
:gitlab_cache_operation_duration_seconds
,
:gitlab_cache_operation_duration_seconds
,
'Cache access time'
,
'Cache access time'
,
Transaction
::
BASE_LABELS
.
merge
({
action:
nil
}),
Transaction
::
BASE_LABELS
.
merge
({
action:
nil
}),
...
@@ -73,7 +73,7 @@ module Gitlab
...
@@ -73,7 +73,7 @@ module Gitlab
end
end
def
metric_cache_misses_total
def
metric_cache_misses_total
@metric_cache_misses_total
||=
Gitlab
::
Metrics
.
counter
(
@metric_cache_misses_total
||=
::
Gitlab
::
Metrics
.
counter
(
:gitlab_cache_misses_total
,
:gitlab_cache_misses_total
,
'Cache read miss'
,
'Cache read miss'
,
Transaction
::
BASE_LABELS
Transaction
::
BASE_LABELS
...
...
lib/gitlab/metrics/transaction.rb
View file @
2056c7de
...
@@ -64,7 +64,7 @@ module Gitlab
...
@@ -64,7 +64,7 @@ module Gitlab
end
end
def
add_metric
(
series
,
values
,
tags
=
{})
def
add_metric
(
series
,
values
,
tags
=
{})
@metrics
<<
Metric
.
new
(
"
#{
Metrics
.
series_prefix
}#{
series
}
"
,
values
,
tags
)
@metrics
<<
Metric
.
new
(
"
#{
::
Gitlab
::
Metrics
.
series_prefix
}#{
series
}
"
,
values
,
tags
)
end
end
# Tracks a business level event
# Tracks a business level event
...
@@ -127,7 +127,7 @@ module Gitlab
...
@@ -127,7 +127,7 @@ module Gitlab
hash
hash
end
end
Metrics
.
submit_metrics
(
submit_hashes
)
::
Gitlab
::
Metrics
.
submit_metrics
(
submit_hashes
)
end
end
def
labels
def
labels
...
...
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