Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Features

- Include otel as custom sampling context ([2683](https://github.com/getsentry/sentry-ruby/pull/2683))
- Ignore new rails rate limit errors ([#2774](https://github.com/getsentry/sentry-ruby/pull/2774))

## 6.1.2

Expand Down
9 changes: 8 additions & 1 deletion sentry-rails/lib/sentry/rails/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class Configuration
after(:initialize) do
@rails = Sentry::Rails::Configuration.new
@excluded_exceptions = @excluded_exceptions.concat(Sentry::Rails::IGNORE_DEFAULT)
@excluded_exceptions = @excluded_exceptions.concat(Sentry::Rails::RAILS_8_1_1_IGNORE_DEFAULT) if Gem::Version.new(::Rails.version) >= Gem::Version.new("8.1.1")

if ::Rails.logger
if defined?(::ActiveSupport::BroadcastLogger) && ::Rails.logger.is_a?(::ActiveSupport::BroadcastLogger)
Expand Down Expand Up @@ -50,12 +51,18 @@ module Rails
"ActionController::RoutingError",
"ActionController::UnknownAction",
"ActionController::UnknownFormat",
"ActionDispatch::Http::MimeNegotiation::InvalidType",
"ActionController::UnknownHttpMethod",
"ActionDispatch::Http::MimeNegotiation::InvalidType",
"ActionDispatch::Http::Parameters::ParseError",
"ActiveRecord::RecordNotFound"
].freeze

# Rails 8.1.1 introduced ActionController::TooManyRequests for rate limiting
# https://github.com/rails/rails/commit/73ecd0ced634e5177496677a2986ec3731c7e2ee
RAILS_8_1_1_IGNORE_DEFAULT = [
"ActionController::TooManyRequests"
].freeze

ACTIVE_SUPPORT_LOGGER_SUBSCRIPTION_ITEMS_DEFAULT = {
# action_controller
"write_fragment.action_controller" => %i[key],
Expand Down
6 changes: 6 additions & 0 deletions sentry-rails/spec/sentry/rails/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
expect(config.excluded_exceptions).to include("ActiveRecord::RecordNotFound")
end

it "ignores ActionController::TooManyRequests by default on Rails 8.1.1+", skip: Gem::Version.new(Rails.version) < Gem::Version.new("8.1.1") do
config = Sentry::Configuration.new

expect(config.excluded_exceptions).to include("ActionController::TooManyRequests")
end

describe "#report_rescued_exceptions" do
it "has correct default value" do
expect(subject.report_rescued_exceptions).to eq(true)
Expand Down