class Frenchy::Instrumentation::LogSubscriber

Public Class Methods

runtime() click to toggle source
# File lib/frenchy/instrumentation.rb, line 28
def self.runtime
  Thread.current[:frenchy_runtime] || 0.0
end

Public Instance Methods

request(event) click to toggle source
# File lib/frenchy/instrumentation.rb, line 14
def request(event)
  Thread.current[:frenchy_runtime] ||= 0.0
  Thread.current[:frenchy_runtime] += event.duration
  if logger.debug?
    name = "%s (%.2fms)" % [event.payload[:service].capitalize, event.duration]
    output = "  #{color(name, YELLOW, bold: true)} #{event.payload[:method].to_s.upcase} #{event.payload[:path]}"
    if event.payload[:params].any?
      output += "?"
      output += event.payload[:params].map {|k,v| "#{k}=#{v}" }.join("&")
    end
    debug output
  end
end
start_processing(event) click to toggle source
# File lib/frenchy/instrumentation.rb, line 10
def start_processing(event)
  Thread.current[:frenchy_runtime] = 0.0
end