Sha256: ba70991b8866ba7efa030872588333662f962b1fc1d5c54bd6839ce17ddcf32c

Contents?: true

Size: 575 Bytes

Versions: 34

Compression:

Stored size: 575 Bytes

Contents

module Messaging
  module Instrumentation
    NAMESPACE = 'messaging'

    def instrument(event, extra = {})
      ActiveSupport::Notifications.instrument("#{NAMESPACE}.#{event}", extra) do |extra|
        yield(extra) if block_given?
      end
    end

    def self.subscribe(event)
      ActiveSupport::Notifications.subscribe("#{NAMESPACE}.#{event}") do |*args|
        yield ActiveSupport::Notifications::Event.new(*args) if block_given?
      end
    end

    def self.unsubscribe(subscriber)
      ActiveSupport::Notifications.unsubscribe(subscriber)
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
messaging-4.0.12 lib/messaging/instrumentation.rb
messaging-4.0.11 lib/messaging/instrumentation.rb
messaging-4.0.10 lib/messaging/instrumentation.rb
messaging-4.0.10.pre lib/messaging/instrumentation.rb
messaging-4.0.9 lib/messaging/instrumentation.rb
messaging-4.0.8 lib/messaging/instrumentation.rb
messaging-4.0.7 lib/messaging/instrumentation.rb
messaging-4.0.6 lib/messaging/instrumentation.rb
messaging-4.0.5 lib/messaging/instrumentation.rb
messaging-4.0.4.pre lib/messaging/instrumentation.rb
messaging-4.0.3.pre lib/messaging/instrumentation.rb
messaging-4.0.2.pre lib/messaging/instrumentation.rb
messaging-4.0.1.pre lib/messaging/instrumentation.rb
messaging-4.0.0.pre lib/messaging/instrumentation.rb
messaging-3.8.2 lib/messaging/instrumentation.rb
messaging-3.8.1 lib/messaging/instrumentation.rb
messaging-3.8.0 lib/messaging/instrumentation.rb
messaging-3.7.3 lib/messaging/instrumentation.rb
messaging-3.7.2 lib/messaging/instrumentation.rb
messaging-3.7.1 lib/messaging/instrumentation.rb