diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-09-06 14:02:42 +0200 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2017-11-02 18:11:43 +0100 |
commit | 4cf6be2be8afdac58a24edbc7d9ae942ed3dca51 (patch) | |
tree | 23da6019321289ee1414cb0921cb68f2441c1437 /lib/gitlab | |
parent | 815b8db1b9b01a994867948bb4b8b4476e83ff47 (diff) | |
download | gitlab-ce-4cf6be2be8afdac58a24edbc7d9ae942ed3dca51.tar.gz |
Differentiatie between class and instance methods
Diffstat (limited to 'lib/gitlab')
-rw-r--r-- | lib/gitlab/metrics/instrumentation.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/gitlab/metrics/instrumentation.rb b/lib/gitlab/metrics/instrumentation.rb index 1b80fef1212..023e9963493 100644 --- a/lib/gitlab/metrics/instrumentation.rb +++ b/lib/gitlab/metrics/instrumentation.rb @@ -118,19 +118,21 @@ module Gitlab def self.instrument(type, mod, name) return unless Metrics.enabled? - name = name.to_sym + name = name.to_sym target = type == :instance ? mod : mod.singleton_class if type == :instance target = mod - label = "#{mod.name}##{name}" + method_name = "##{name}" method = mod.instance_method(name) else target = mod.singleton_class - label = "#{mod.name}.#{name}" + method_name = ".#{name}" method = mod.method(name) end + label = "#{mod.name}#{method_name}" + unless instrumented?(target) target.instance_variable_set(PROXY_IVAR, Module.new) end @@ -153,7 +155,7 @@ module Gitlab proxy_module.class_eval <<-EOF, __FILE__, __LINE__ + 1 def #{name}(#{args_signature}) 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 } else super |