BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
ad69ba57
Commit
ad69ba57
authored
Dec 10, 2015
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Proper method instrumentation for special symbols
This ensures that methods such as "==" can be instrumented without producing syntax errors.
parent
1b077d2d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
instrumentation.rb
lib/gitlab/metrics/instrumentation.rb
+5
-4
No files found.
lib/gitlab/metrics/instrumentation.rb
View file @
ad69ba57
...
...
@@ -30,7 +30,8 @@ module Gitlab
def
self
.
instrument
(
type
,
mod
,
name
)
return
unless
Metrics
.
enabled?
alias_name
=
"_original_
#{
name
}
"
name
=
name
.
to_sym
alias_name
=
:"_original_
#{
name
}
"
target
=
type
==
:instance
?
mod
:
mod
.
singleton_class
if
type
==
:instance
...
...
@@ -42,14 +43,14 @@ module Gitlab
end
target
.
class_eval
<<-
EOF
,
__FILE__
,
__LINE__
+
1
alias_method
:
#{
alias_name
}
, :
#{
name
}
alias_method
#{
alias_name
.
inspect
}
,
#{
name
.
inspect
}
def
#{
name
}
(*args, &block)
trans = Gitlab::Metrics::Instrumentation.transaction
if trans
start = Time.now
retval =
#{
alias_name
}
(*args, &block)
retval =
duration = (Time.now - start) * 1000.0
trans.add_metric(Gitlab::Metrics::Instrumentation::SERIES,
...
...
@@ -58,7 +59,7 @@ module Gitlab
retval
else
#{
alias_name
}
(
*args, &block)
__send__(
#{
alias_name
.
inspect
}
,
*args, &block)
end
end
EOF
...
...
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