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
5a085dc1
Commit
5a085dc1
authored
Nov 03, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing mutex guard to method call metrics
parent
765ddaeb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
lib/gitlab/metrics/method_call.rb
lib/gitlab/metrics/method_call.rb
+21
-12
No files found.
lib/gitlab/metrics/method_call.rb
View file @
5a085dc1
...
@@ -2,10 +2,14 @@ module Gitlab
...
@@ -2,10 +2,14 @@ module Gitlab
module
Metrics
module
Metrics
# Class for tracking timing information about method calls
# Class for tracking timing information about method calls
class
MethodCall
class
MethodCall
MUTEX
=
Mutex
.
new
BASE_LABELS
=
{
module:
nil
,
method:
nil
}.
freeze
BASE_LABELS
=
{
module:
nil
,
method:
nil
}.
freeze
attr_reader
:real_time
,
:cpu_time
,
:call_count
,
:labels
attr_reader
:real_time
,
:cpu_time
,
:call_count
,
:labels
def
self
.
call_real_duration_histogram
def
self
.
call_real_duration_histogram
return
@call_real_duration_histogram
if
@call_real_duration_histogram
MUTEX
.
synchronize
do
@call_real_duration_histogram
||=
Gitlab
::
Metrics
.
histogram
(
@call_real_duration_histogram
||=
Gitlab
::
Metrics
.
histogram
(
:gitlab_method_call_real_duration_seconds
,
:gitlab_method_call_real_duration_seconds
,
'Method calls real duration'
,
'Method calls real duration'
,
...
@@ -13,8 +17,12 @@ module Gitlab
...
@@ -13,8 +17,12 @@ module Gitlab
[
0.1
,
0.2
,
0.5
,
1
,
2
,
5
,
10
]
[
0.1
,
0.2
,
0.5
,
1
,
2
,
5
,
10
]
)
)
end
end
end
def
self
.
call_cpu_duration_histogram
def
self
.
call_cpu_duration_histogram
return
@call_cpu_duration_histogram
if
@call_cpu_duration_histogram
MUTEX
.
synchronize
do
@call_duration_histogram
||=
Gitlab
::
Metrics
.
histogram
(
@call_duration_histogram
||=
Gitlab
::
Metrics
.
histogram
(
:gitlab_method_call_cpu_duration_seconds
,
:gitlab_method_call_cpu_duration_seconds
,
'Method calls cpu duration'
,
'Method calls cpu duration'
,
...
@@ -22,6 +30,7 @@ module Gitlab
...
@@ -22,6 +30,7 @@ module Gitlab
[
0.1
,
0.2
,
0.5
,
1
,
2
,
5
,
10
]
[
0.1
,
0.2
,
0.5
,
1
,
2
,
5
,
10
]
)
)
end
end
end
# name - The full name of the method (including namespace) such as
# name - The full name of the method (including namespace) such as
# `User#sign_in`.
# `User#sign_in`.
...
...
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