module ROM::Plugins::Relation::Instrumentation

Experimental plugin for configuring relations with an external instrumentation system like dry-monitor or ActiveSupport::Notifications

@api public

Public Class Methods

included(klass) click to toggle source

This hooks sets up a relation class with injectible notifications object

@api private

Calls superclass method
# File lib/rom/plugins/relation/instrumentation.rb, line 18
def self.included(klass)
  super
  klass.option :notifications
  klass.extend(ClassInterface)
  klass.prepend(mixin)
  klass.instrument(:to_a)
end

Public Instance Methods

instrument(&block) click to toggle source

Execute a block using instrumentation

@api public

# File lib/rom/plugins/relation/instrumentation.rb, line 50
def instrument(&block)
  notifications.instrument(self.class.adapter, name: name.relation, **notification_payload(self), &block)
end

Private Instance Methods

notification_payload(_relation) click to toggle source

@api private

# File lib/rom/plugins/relation/instrumentation.rb, line 57
def notification_payload(_relation)
  EMPTY_HASH
end