class Airbrake::Rails::Event
Experimental RBS support (using type sampling data from the type_fusion project).
# sig/airbrake/rails/event.rbs class Airbrake::Rails::Event def duration: () -> untyped def initialize: (*Array[String] args) -> void def method: () -> untyped def response_type: () -> untyped def sql: () -> untyped def status_code: () -> untyped def time: () -> untyped end
@api private
@since v9.0.3
Event is a wrapper around ActiveSupport::Notifications::Event.
def db_runtime
def db_runtime @db_runtime ||= @event.payload[:db_runtime] || 0 end
def duration
Experimental RBS support (using type sampling data from the type_fusion project).
def duration: () -> untyped
This signature was generated using 6 samples from 1 application.
def duration @event.duration end
def groups
def groups groups = {} groups[:db] = db_runtime if db_runtime > 0 groups[:view] = view_runtime if view_runtime > 0 groups end
def initialize(*args)
Experimental RBS support (using type sampling data from the type_fusion project).
type Airbrake__Rails__Event_initialize_args = Time | Time | String | Hash | sql | String | name | String | binds | Array | | type_casted_binds | Array | | statement_name | NilClass | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | Time | Time | String | Hash | sql | String | name | String | binds | Array | ActiveRecord::Relation::QueryAttribute | ActiveModel::Attribute::WithCastValue | type_casted_binds | Array | Integer | Integer | statement_name | String | async | FalseClass | connection | ActiveRecord::ConnectionAdapters::PostgreSQLAdapter | Time | Time | String | Hash | controller | String | action | String | request | ActionDispatch::Request | params | Hash | connected_folder | Hash | connected_account_id | String | folder_id | String | linked_connection_invitation_attributes | Hash | email | String | connected_account_folder | Hash | name | String | parent_folder_id | String | commit | String | controller | String | action | String | headers | ActionDispatch::Http::Headers | format | Symbol | method | String | path | String | Time | Time | String | Hash | controller | String | action | String | request | ActionDispatch::Request | params | Hash | _method | String | controller | String | action | String | id | String | headers | ActionDispatch::Http::Headers | format | Symbol | method | String | path | String def initialize: (*Airbrake__Rails__Event_initialize_args args) -> void
This signature was generated using 5 samples from 1 application.
def initialize(*args) @event = ActiveSupport::Notifications::Event.new(*args) @rails_7_or_greater = ::Rails::VERSION::MAJOR >= 7 end
def method
Experimental RBS support (using type sampling data from the type_fusion project).
def method: () -> untyped
This signature was generated using 2 samples from 1 application.
def method @event.payload[:method] end
def params
def params @event.payload[:params] end
def response_type
Experimental RBS support (using type sampling data from the type_fusion project).
def response_type: () -> untyped
This signature was generated using 4 samples from 1 application.
def response_type response_type = @event.payload[:format] response_type == HTML_RESPONSE_WILDCARD ? :html : response_type end
def sql
Experimental RBS support (using type sampling data from the type_fusion project).
def sql: () -> untyped
This signature was generated using 2 samples from 1 application.
def sql @event.payload[:sql] end
def status_code
Experimental RBS support (using type sampling data from the type_fusion project).
def status_code: () -> untyped
This signature was generated using 1 sample from 1 application.
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
def time
Experimental RBS support (using type sampling data from the type_fusion project).
def time: () -> untyped
This signature was generated using 5 samples from 1 application.
def time # On RailsĀ 7+ `ActiveSupport::Notifications::Event#time` returns an # instance of Float. It represents monotonic time in milliseconds. # Airbrake Ruby expects that the provided time is in seconds. Hence, # we need to convert it from milliseconds to seconds. In the # versions below Rails 7, time is an instance of Time. # # Relevant commit: # https://github.com/rails/rails/commit/81d0dc90becfe0b8e7f7f26beb66c25d84b8ec7f @rails_7_or_greater ? @event.time / MILLISECOND : @event.time end
def view_runtime
def view_runtime @view_runtime ||= @event.payload[:view_runtime] || 0 end