getsentry / sentry-ruby

Sentry SDK for Ruby
https://sentry.io/for/ruby
MIT License
933 stars 494 forks source link

config.excluded_exceptions not working as expected. #2164

Closed rodolfoBee closed 1 year ago

rodolfoBee commented 1 year ago

Issue Description

User is trying to filter Redis::CannotConnectError exceptions with excluded_exceptions option but it is still being sent to Sentry.

Initially reported in this ticket.

Reproduction Steps

1.Set the SDK as described below 2.Trigger a redis connection error

Expected Behavior

The event is filtered

Actual Behavior

The event is sent to Sentry.

Here is the output when checking the SDK option:

irb(main):005:0> Sentry.configuration.excluded_exceptions
=>
["Mongoid::Errors::DocumentNotFound",
"Rack::QueryParser::InvalidParameterError",
"Rack::QueryParser::ParameterTypeError",
"Sinatra::NotFound",
"Puma::MiniSSL::SSLError",
"Puma::HttpParserError",
"Puma::HttpParserError501",
"AbstractController::ActionNotFound",
"ActionController::BadRequest",
"ActionController::InvalidAuthenticityToken",
"ActionController::InvalidCrossOriginRequest",
"ActionController::MethodNotAllowed",
"ActionController::NotImplemented",
"ActionController::ParameterMissing",
"ActionController::RoutingError",
"ActionController::UnknownAction",
"ActionController::UnknownFormat",
"ActionDispatch::Http::MimeNegotiation::InvalidType",
"ActionController::UnknownHttpMethod",
"ActionDispatch::Http::Parameters::ParseError",
"ActiveRecord::RecordNotFound",
"Sidekiq::JobRetry::Skip",
"BaseWorker::SidekiqRetry",
"ActionController::UnknownFormat",
"ActionController::RoutingError",
"ActionController::UnknownHttpMethod",
"Mime::Type::InvalidMimeType",
"ThreadError",
"ContactsManager::LimitError",
"Pollable::AbortPolling",
"ActionDispatch::Cookies::CookieOverflow",
"Redis::CannotConnectError,",
"Redis::TimeoutError"]

Ruby Version

3.0.0

SDK Version

5.10.0

Integration and Its Version

No response

Sentry Config

Sentry.init do |config|
config.dsn = "__MY_DSN__"
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
config.environment = if is_canary
"#{Rails.env}-canary"
else
Rails.env
end
config.enabled_environments = %w[production staging production-canary]
config.excluded_exceptions += %w[
BaseWorker::SidekiqRetry
ActionController::UnknownFormat
ActionController::RoutingError
ActionController::UnknownHttpMethod
Mime::Type::InvalidMimeType
ThreadError
ContactsManager::LimitError
Pollable::AbortPolling
ActionDispatch::Cookies::CookieOverflow
]
if Rails.env.staging? && ENV["BRANCH_DEPLOY_SUBDOMAIN"]
config.excluded_exceptions += %w[Redis::CannotConnectError, Redis::TimeoutError]
end
sl0thentr0py commented 1 year ago

they have a bad comma in their entry

"Redis::CannotConnectError,",
chen-anders commented 1 year ago

Ah - thanks for the catch 🤦 - I think that was it