Skip to content
Browse files

Adjusting the test_statsd_count_with_name_as_lambda test for argument…

…s passing
  • Loading branch information...
1 parent f48ec36 commit a59b151ca6c157057475e9bb71e159c01bfba752 @freeatnet freeatnet committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/statsd/instrument.rb
View
8 lib/statsd/instrument.rb
@@ -30,7 +30,7 @@ module Instrument
def statsd_measure(method, name, sample_rate = StatsD.default_sample_rate)
add_to_method(method, name, :measure) do |old_method, new_method, metric_name, *args|
define_method(new_method) do |*args, &block|
- StatsD.measure(metric_name.respond_to?(:call) ? metric_name.call(self) : metric_name, nil, sample_rate) { send(old_method, *args, &block) }
+ StatsD.measure(metric_name.respond_to?(:call) ? metric_name.call(self, args) : metric_name, nil, sample_rate) { send(old_method, *args, &block) }
end
end
end
@@ -47,7 +47,7 @@ def statsd_count_success(method, name, sample_rate = StatsD.default_sample_rate)
truthiness = (yield(result) rescue false) if block_given?
result
ensure
- StatsD.increment("#{metric_name.respond_to?(:call) ? metric_name.call(self) : metric_name}." + (truthiness == false ? 'failure' : 'success'), sample_rate)
+ StatsD.increment("#{metric_name.respond_to?(:call) ? metric_name.call(self, args) : metric_name}." + (truthiness == false ? 'failure' : 'success'), sample_rate)
end
end
end
@@ -65,7 +65,7 @@ def statsd_count_if(method, name, sample_rate = StatsD.default_sample_rate)
truthiness = (yield(result) rescue false) if block_given?
result
ensure
- StatsD.increment(metric_name.respond_to?(:call) ? metric_name.call(self) : metric_name, sample_rate) if truthiness
+ StatsD.increment(metric_name.respond_to?(:call) ? metric_name.call(self, args) : metric_name, sample_rate) if truthiness
end
end
end
@@ -74,7 +74,7 @@ def statsd_count_if(method, name, sample_rate = StatsD.default_sample_rate)
def statsd_count(method, name, sample_rate = StatsD.default_sample_rate)
add_to_method(method, name, :count) do |old_method, new_method, metric_name|
define_method(new_method) do |*args, &block|
- StatsD.increment(metric_name.respond_to?(:call) ? metric_name.call(self) : metric_name, sample_rate)
+ StatsD.increment(metric_name.respond_to?(:call) ? metric_name.call(self, args) : metric_name, sample_rate)
send(old_method, *args, &block)
end
end

0 comments on commit a59b151

Please sign in to comment.
Something went wrong with that request. Please try again.