Class: ActiveInsights::Request
- Defined in:
- app/models/active_insights/request.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Record
#agony, #p50, #p95, #p99, #parsed_durations, #pretty_started_at
Class Method Details
.setup(started, finished, unique_id, payload) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'app/models/active_insights/request.rb', line 5 def self.setup(started, finished, unique_id, payload) req = payload[:request] create!(started_at: started, ip_address: req.remote_ip, finished_at: finished, uuid: unique_id, http_method: payload[:method], user_agent: req.user_agent, **payload.slice(:controller, :action, :format, :status, :view_runtime, :db_runtime, :path)) end |
Instance Method Details
#percentage(others) ⇒ Object
15 16 17 |
# File 'app/models/active_insights/request.rb', line 15 def percentage(others) (agony / others.sum(&:agony)) * 100.0 end |