Skip to content
Snippets Groups Projects
Commit f43f3b89 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Added Instrumentation.configure

This makes it easier to instrument multiple modules without having to
type the full namespace over and over again.
parent 5dbcb635
No related branches found
No related tags found
1 merge request!2042Storing of application metrics in InfluxDB
Loading
Loading
@@ -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.
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment