module QueueKit::Instrumentable

Public Instance Methods

debug() click to toggle source
# File lib/queue_kit/instrumentable.rb, line 24
def debug
end
default_instrument_options() click to toggle source
# File lib/queue_kit/instrumentable.rb, line 33
def default_instrument_options
  {}
end
default_instrumenter() click to toggle source
# File lib/queue_kit/instrumentable.rb, line 37
def default_instrumenter
  PutsInstrumenter.new
end
enable_debug_mode() click to toggle source
# File lib/queue_kit/instrumentable.rb, line 27
def enable_debug_mode
  class << self
    alias debug force_debug
  end
end
force_debug() { || ... } click to toggle source
# File lib/queue_kit/instrumentable.rb, line 20
def force_debug
  instrument(*yield)
end
instrument(name, payload = nil) click to toggle source
# File lib/queue_kit/instrumentable.rb, line 14
def instrument(name, payload = nil)
  options = default_instrument_options
  options.update(payload) if payload
  instrumenter.instrument("queuekit.#{name}", options)
end
instrumenter() click to toggle source
# File lib/queue_kit/instrumentable.rb, line 10
def instrumenter
  @instrumenter ||= default_instrumenter
end
instrumenter_from(options) click to toggle source
# File lib/queue_kit/instrumentable.rb, line 3
def instrumenter_from(options)
  @instrumenter = options[:instrumenter]
  if options.fetch(:debug) { false }
    enable_debug_mode
  end
end