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
f43f3b89
Commit
f43f3b89
authored
Dec 10, 2015
by
Yorick Peterse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Instrumentation.configure
This makes it easier to instrument multiple modules without having to type the full namespace over and over again.
parent
5dbcb635
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletion
+13
-1
instrumentation.rb
lib/gitlab/metrics/instrumentation.rb
+4
-0
instrumentation_spec.rb
spec/lib/gitlab/metrics/instrumentation_spec.rb
+9
-1
No files found.
lib/gitlab/metrics/instrumentation.rb
View file @
f43f3b89
...
...
@@ -11,6 +11,10 @@ module Gitlab
module
Instrumentation
SERIES
=
'method_calls'
def
self
.
configure
yield
self
end
# Instruments a class method.
#
# mod - The module to instrument as a Module/Class.
...
...
spec/lib/gitlab/metrics/instrumentation_spec.rb
View file @
f43f3b89
...
...
@@ -17,12 +17,20 @@ describe Gitlab::Metrics::Instrumentation do
allow
(
@dummy
).
to
receive
(
:name
).
and_return
(
'Dummy'
)
end
describe
'.configure'
do
it
'yields self'
do
described_class
.
configure
do
|
c
|
expect
(
c
).
to
eq
(
described_class
)
end
end
end
describe
'.instrument_method'
do
describe
'with metrics enabled'
do
before
do
allow
(
Gitlab
::
Metrics
).
to
receive
(
:enabled?
).
and_return
(
true
)
Gitlab
::
Metrics
::
Instrumentation
.
instrument_method
(
@dummy
,
:foo
)
described_class
.
instrument_method
(
@dummy
,
:foo
)
end
it
'renames the original method'
do
...
...
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