lib/nunes/subscriber.rb in nunes-0.1.0 vs lib/nunes/subscriber.rb in nunes-0.2.0

- old
+ new

@@ -30,40 +30,35 @@ # Private: Dispatcher that converts incoming events to method calls. def call(name, start, ending, transaction_id, payload) # rails doesn't recommend instrumenting methods that start with bang # when in production - return if name.starts_with?(BANG) + return if name.start_with?(BANG) method_name = name.split('.').first if respond_to?(method_name) send(method_name, start, ending, transaction_id, payload) - else - $stderr.puts "#{self.class.name} did not respond to #{method_name} therefore it cannot instrument the event named #{name}." end end # Internal: Increment a metric for the client. # # metric - The String name of the metric to increment. + # value - The Integer value to increment by. # # Returns nothing. - def increment(metric) - if @adapter - @adapter.increment metric - end + def increment(metric, value = 1) + @adapter.increment metric, value end # Internal: Track the timing of a metric for the client. # # metric - The String name of the metric. - # duration_in_ms - The Integer duration of the event in milliseconds. + # value - The Integer duration of the event in milliseconds. # # Returns nothing. - def timing(metric, duration_in_ms) - if @adapter - @adapter.timing metric, duration_in_ms - end + def timing(metric, value) + @adapter.timing metric, value end end end