Module: BusinessFlow::Instrument::ClassMethods

Defined in:
lib/business_flow/instrument.rb

Overview

Contains methods that we add to the DSL

Constant Summary collapse

INSTRUMENTATION_PREFIX =
'business_flow'.freeze

Instance Method Summary collapse

Instance Method Details

#event_nameObject



34
35
36
37
# File 'lib/business_flow/instrument.rb', line 34

def event_name
  @event_name ||=
    "#{INSTRUMENTATION_PREFIX}.flow.#{instrumentation_name}".freeze
end

#instrument(name, flow) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/business_flow/instrument.rb', line 16

def instrument(name, flow)
  payload = { flow: flow }
  ActiveSupport::Notifications.instrument(
    "#{INSTRUMENTATION_PREFIX}.#{name}.#{instrumentation_name}", payload
  ) do
    yield payload
  end
end

#instrument_stepsObject



25
26
27
# File 'lib/business_flow/instrument.rb', line 25

def instrument_steps
  step_executor ::BusinessFlow::InstrumentedStepExecutor
end

#instrumentation_nameObject



29
30
31
32
# File 'lib/business_flow/instrument.rb', line 29

def instrumentation_name
  @instrumentation_name ||=
    to_s.underscore.freeze
end