Class: RailsErrorDashboard::RackAttackEvent

Inherits:
ErrorLogsRecord
  • Object
show all
Defined in:
app/models/rails_error_dashboard/rack_attack_event.rb

Overview

Stores aggregated Rack::Attack throttle/blocklist/track events per hourly bucket.

Rack::Attack events are NOT errors — a throttled request returns HTTP 429 without raising. They are therefore persisted independently of error_logs rather than as a side-effect of error capture (see issue #143).

Rows are aggregated hourly by (rule, match_type, discriminator, path) so that a rate-limit flood collapses to a handful of rows instead of one INSERT per request.

Constant Summary collapse

MATCH_TYPES =

Event types emitted by Rack::Attack (v5.0+)

%w[throttle blocklist track safelist].freeze

Instance Method Summary collapse

Instance Method Details

#blocked?Boolean

Whether this event represents a hard block rather than a rate limit

Returns:

  • (Boolean)


32
33
34
# File 'app/models/rails_error_dashboard/rack_attack_event.rb', line 32

def blocked?
  match_type == "blocklist"
end