1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
# Note: You should never need to require this file directly if you are using
# ActiveSupport::Notifications. Instead, you should require the statsd file
# that lives in the same directory as this file. The benefit is that it
# subscribes to the correct events and does everything for your.
require 'flipper/instrumentation/subscriber'
module Flipper
module Instrumentation
class StatsdSubscriber < Subscriber
class << self
attr_accessor :client
end
def update_timer(metric)
if self.class.client
self.class.client.timing metric, (@duration * 1_000).round
end
end
def update_counter(metric)
self.class.client.increment metric if self.class.client
end
end
end
end
|