Sha256: 09c56f26943dad9dfafe3ab69adc952c5b1b12d7595fb908e3cd63ea42c0eec2

Contents?: true

Size: 776 Bytes

Versions: 4

Compression:

Stored size: 776 Bytes

Contents

# 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)
        if self.class.client
          self.class.client.increment metric
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
flipper-0.10.2 lib/flipper/instrumentation/statsd_subscriber.rb
flipper-0.10.1 lib/flipper/instrumentation/statsd_subscriber.rb
flipper-0.10.0 lib/flipper/instrumentation/statsd_subscriber.rb
flipper-0.9.2 lib/flipper/instrumentation/statsd_subscriber.rb