Sha256: 52f2c4f0a36aeef6707bf2f78e38e89a6494a656ca2716000db315dd605e5998
Contents?: true
Size: 1022 Bytes
Versions: 16
Compression:
Stored size: 1022 Bytes
Contents
module BusinessFlow # Include me to fire ActiveSupport notifications on the flow, every step, # and for any errors that happen. module Instrument def self.included(klass) klass.extend(ClassMethods) klass.step_executor ::BusinessFlow::InstrumentedExecutor end # Contains methods that we add to the DSL module ClassMethods INSTRUMENTATION_PREFIX = 'business_flow'.freeze def instrument(name, flow) payload = { flow: flow } ActiveSupport::Notifications.instrument( "#{INSTRUMENTATION_PREFIX}.#{name}.#{instrumentation_name}", payload ) do yield payload end end def instrument_steps step_executor ::BusinessFlow::InstrumentedStepExecutor end def instrumentation_name @instrumentation_name ||= to_s.underscore.freeze end def event_name @event_name ||= "#{INSTRUMENTATION_PREFIX}.flow.#{instrumentation_name}".freeze end end end end
Version data entries
16 entries across 16 versions & 1 rubygems