Class: Rack::Profilers::Stathat
- Inherits:
-
RequestProfiler
- Object
- RequestProfiler
- Rack::Profilers::Stathat
- Defined in:
- lib/rack/profilers/stathat.rb
Overview
NOTE: This middleware expects that you are running an EventMachine reactor in the current process, and should not be used otherwise.
Constant Summary
Constants inherited from RequestProfiler
Instance Method Summary collapse
- #handle_results(env, request) ⇒ Object
-
#initialize(app, opts = {}) ⇒ Stathat
constructor
A new instance of Stathat.
Methods inherited from RequestProfiler
#call, #run_time, #start_time, #start_time=
Constructor Details
#initialize(app, opts = {}) ⇒ Stathat
Returns a new instance of Stathat.
14 15 16 |
# File 'lib/rack/profilers/stathat.rb', line 14 def initialize(app, opts = {}) @app, @opts = app, opts end |
Instance Method Details
#handle_results(env, request) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/rack/profilers/stathat.rb', line 21 def handle_results(env, request) clean_url = Utils::UrlStripper.replace_id(request.path) EM.next_tick do deferrable = EM::StatHat.new.ez_value("#{request.request_method} #{clean_url}", run_time) deferrable.callback(&@opts[:callback]) if @opts[:callback] deferrable.errback(&@opts[:errback]) if @opts[:errback] end end |