Sha256: 5229fbb073c060ffb7170c5649d44813b7543bc14bb0ecb8c8f71108ab399139
Contents?: true
Size: 738 Bytes
Versions: 17
Compression:
Stored size: 738 Bytes
Contents
require 'hallmonitor/outputter' module Hallmonitor class Middleware def initialize(app) @app = app end def call(env) request = Rack::Request.new(env) @event_base_name = "http.#{request.path_info.gsub('/', '.')}.#{request.request_method}" if !request.path_info.match(/^\/?assets/) @event = Hallmonitor::TimedEvent.new("#{@event_base_name}.response_time") @event.start = Time.now else @event = nil end response = @app.call(env) if @event @event.stop = Time.now Hallmonitor::Outputter.output(@event) Hallmonitor::Outputter.output(Hallmonitor::Event.new("#{@event_base_name}.count")) end response end end end
Version data entries
17 entries across 17 versions & 1 rubygems