class Airbrake::Rails::Event
Event
is a wrapper around ActiveSupport::Notifications::Event.
@since v9.0.3 @api private
Constants
- HTML_RESPONSE_WILDCARD
Public Class Methods
new(*args)
click to toggle source
# File lib/airbrake/rails/event.rb, line 13 def initialize(*args) @event = ActiveSupport::Notifications::Event.new(*args) end
Public Instance Methods
db_runtime()
click to toggle source
# File lib/airbrake/rails/event.rb, line 34 def db_runtime @db_runtime ||= @event.payload[:db_runtime] || 0 end
duration()
click to toggle source
# File lib/airbrake/rails/event.rb, line 78 def duration @event.duration end
end()
click to toggle source
# File lib/airbrake/rails/event.rb, line 46 def end @event.end end
groups()
click to toggle source
# File lib/airbrake/rails/event.rb, line 50 def groups groups = {} groups[:db] = db_runtime if db_runtime > 0 groups[:view] = view_runtime if view_runtime > 0 groups end
method()
click to toggle source
# File lib/airbrake/rails/event.rb, line 17 def method @event.payload[:method] end
params()
click to toggle source
# File lib/airbrake/rails/event.rb, line 26 def params @event.payload[:params] end
response_type()
click to toggle source
# File lib/airbrake/rails/event.rb, line 21 def response_type response_type = @event.payload[:format] response_type == HTML_RESPONSE_WILDCARD ? :html : response_type end
sql()
click to toggle source
# File lib/airbrake/rails/event.rb, line 30 def sql @event.payload[:sql] end
status_code()
click to toggle source
# File lib/airbrake/rails/event.rb, line 57 def status_code return @event.payload[:status] if @event.payload[:status] if @event.payload[:exception] status = ActionDispatch::ExceptionWrapper.status_code_for_exception( @event.payload[:exception].first ) status = 500 if status == 0 return status end # The ActiveSupport event doesn't have status only in two cases: # - an exception was thrown # - unauthorized access # We have already handled the exception so what's left is unauthorized # access. There's no way to know for sure it's unauthorized access, so # we are rather optimistic here. 401 end
time()
click to toggle source
# File lib/airbrake/rails/event.rb, line 42 def time @event.time end
view_runtime()
click to toggle source
# File lib/airbrake/rails/event.rb, line 38 def view_runtime @view_runtime ||= @event.payload[:view_runtime] || 0 end