Sha256: 9287c170c0d1968646c525e5207c1b0a1f71dc1faee13aaa59b2c13f58382d29

Contents?: true

Size: 749 Bytes

Versions: 4

Compression:

Stored size: 749 Bytes

Contents

module Freno
  class Throttler

    # An Instrumenter is an object that responds to
    # `instrument(event_name, payload = {})` to receive events from the
    # throttler.
    #
    # As an example, in a rails app one could use ActiveSupport::Notifications
    # as an instrumenter and subscribe to the "freno.*" events somewhere else in
    # the application.
    #
    module Instrumenter

      # The Noop instrumenter is the `:instrumenter` used by default in the
      # Throttler
      #
      # It does nothing but yielding the control to the block given if it is
      # provided.
      #
      class Noop
        def self.instrument(event_name, payload = {})
          yield payload if block_given?
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
freno-client-0.8.1 lib/freno/throttler/instrumenter.rb
freno-client-0.8.0 lib/freno/throttler/instrumenter.rb
freno-client-0.7.0 lib/freno/throttler/instrumenter.rb
freno-client-0.6.0 lib/freno/throttler/instrumenter.rb