Module: Vx::Lib::Consumer::Instrument

Included in:
Session, Subscriber
Defined in:
lib/vx/lib/consumer/instrument.rb

Instance Method Summary collapse

Instance Method Details

#instrument(name, payload, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/vx/lib/consumer/instrument.rb', line 6

def instrument(name, payload, &block)
  name = "#{name}.consumer.vx".freeze

  if Consumer.configuration.debug?
    $stdout.puts " --> #{name}: #{payload}"
  end

  if Consumer.configuration.instrumenter
    Consumer.configuration.instrumenter.instrument(name, payload, &block)
  else
    begin
      yield if block_given?
    rescue Exception => e
      Consumer.handle_exception(e, {})
    end
  end
end