Class: Rack::Profilers::Statsd
- Inherits:
-
RequestProfiler
- Object
- RequestProfiler
- Rack::Profilers::Statsd
- Defined in:
- lib/rack/profilers/statsd.rb
Constant Summary
Constants inherited from RequestProfiler
Instance Method Summary collapse
- #handle_results(env, request) ⇒ Object
-
#initialize(app, statsd, opts = {}) ⇒ Statsd
constructor
A new instance of Statsd.
Methods inherited from RequestProfiler
#call, #run_time, #start_time, #start_time=
Constructor Details
#initialize(app, statsd, opts = {}) ⇒ Statsd
Returns a new instance of Statsd.
15 16 17 |
# File 'lib/rack/profilers/statsd.rb', line 15 def initialize(app, statsd, opts = {}) @app, @statsd, @opts = app, statsd, opts end |
Instance Method Details
#handle_results(env, request) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/rack/profilers/statsd.rb', line 19 def handle_results(env, request) clean_url = Utils::UrlStripper.replace_id(request.path) clean_url = clean_url[1..-1].gsub('/', '.') namespace = @opts[:namespace] || '' @statsd.timing("#{namespace}#{request.request_method}.#{clean_url}", run_time) end |