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
4cf6be2b
Commit
4cf6be2b
authored
Sep 06, 2017
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Differentiatie between class and instance methods
parent
815b8db1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
lib/gitlab/metrics/instrumentation.rb
lib/gitlab/metrics/instrumentation.rb
+6
-4
No files found.
lib/gitlab/metrics/instrumentation.rb
View file @
4cf6be2b
...
@@ -118,19 +118,21 @@ module Gitlab
...
@@ -118,19 +118,21 @@ module Gitlab
def
self
.
instrument
(
type
,
mod
,
name
)
def
self
.
instrument
(
type
,
mod
,
name
)
return
unless
Metrics
.
enabled?
return
unless
Metrics
.
enabled?
name
=
name
.
to_sym
name
=
name
.
to_sym
target
=
type
==
:instance
?
mod
:
mod
.
singleton_class
target
=
type
==
:instance
?
mod
:
mod
.
singleton_class
if
type
==
:instance
if
type
==
:instance
target
=
mod
target
=
mod
label
=
"
#{
mod
.
name
}
#
#{
name
}
"
method_name
=
"
#
#{
name
}
"
method
=
mod
.
instance_method
(
name
)
method
=
mod
.
instance_method
(
name
)
else
else
target
=
mod
.
singleton_class
target
=
mod
.
singleton_class
label
=
"
#{
mod
.
name
}
.
#{
name
}
"
method_name
=
"
.
#{
name
}
"
method
=
mod
.
method
(
name
)
method
=
mod
.
method
(
name
)
end
end
label
=
"
#{
mod
.
name
}#{
method_name
}
"
unless
instrumented?
(
target
)
unless
instrumented?
(
target
)
target
.
instance_variable_set
(
PROXY_IVAR
,
Module
.
new
)
target
.
instance_variable_set
(
PROXY_IVAR
,
Module
.
new
)
end
end
...
@@ -153,7 +155,7 @@ module Gitlab
...
@@ -153,7 +155,7 @@ module Gitlab
proxy_module
.
class_eval
<<-
EOF
,
__FILE__
,
__LINE__
+
1
proxy_module
.
class_eval
<<-
EOF
,
__FILE__
,
__LINE__
+
1
def
#{
name
}
(
#{
args_signature
}
)
def
#{
name
}
(
#{
args_signature
}
)
if trans = Gitlab::Metrics::Instrumentation.transaction
if trans = Gitlab::Metrics::Instrumentation.transaction
trans.method_call_for(
#{
label
.
to_sym
.
inspect
}
,
#{
mod
.
name
.
to_sym
.
inspect
}
,
#{
name
.
to_sym
.
inspect
}
)
trans.method_call_for(
#{
label
.
to_sym
.
inspect
}
,
#{
mod
.
name
.
inspect
}
, "
#{
method_name
}
"
)
.measure { super }
.measure { super }
else
else
super
super
...
...
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