Class: Wurk::Sentry::ErrorHandler
- Inherits:
-
Object
- Object
- Wurk::Sentry::ErrorHandler
- Defined in:
- lib/wurk/sentry/error_handler.rb
Overview
config.error_handlers entry: reports the failures that never become a
job failure — fetch-loop errors (context: "Error fetching job"),
shutdown-path errors ("!shutdown"), unparseable payloads
("Invalid JSON"), and the retry machinery's own meta-errors (a raising
sidekiq_retry_in / sidekiq_retries_exhausted block, a raising death
handler). Middleware covers job failures; these are the rest.
Handler signature is Sidekiq's: call(exception, context_hash, config).
Constant Summary collapse
- DEFAULT_FILTERED_ERROR_CLASSES =
Transport blips the pool already retried before re-raising. Wurk's default handler logs these at WARN precisely because they are self-healing (
Configuration::REDIS_ERROR_CLASSES), and the fetch loop runs them in a tightsleep(1)cycle: on one production Dragonfly backend a single Sentry issue accumulated ~136,000 events from fetch blips while the job pipeline was completely healthy. They stay in the logs; they just stop paging anyone. Wurk::Configuration::REDIS_ERROR_CLASSES
Instance Attribute Summary collapse
-
#filtered_error_classes ⇒ Object
readonly
Returns the value of attribute filtered_error_classes.
Instance Method Summary collapse
- #call(exception, context = {}, _config = nil) ⇒ Object
- #filtered?(exception) ⇒ Boolean
-
#initialize(filter_transport_errors: true, filtered_error_classes: nil) ⇒ ErrorHandler
constructor
A new instance of ErrorHandler.
Constructor Details
#initialize(filter_transport_errors: true, filtered_error_classes: nil) ⇒ ErrorHandler
Returns a new instance of ErrorHandler.
27 28 29 30 |
# File 'lib/wurk/sentry/error_handler.rb', line 27 def initialize(filter_transport_errors: true, filtered_error_classes: nil) @filter_transport_errors = filter_transport_errors @filtered_error_classes = (filtered_error_classes || DEFAULT_FILTERED_ERROR_CLASSES).to_a.freeze end |
Instance Attribute Details
#filtered_error_classes ⇒ Object (readonly)
Returns the value of attribute filtered_error_classes.
25 26 27 |
# File 'lib/wurk/sentry/error_handler.rb', line 25 def filtered_error_classes @filtered_error_classes end |
Instance Method Details
#call(exception, context = {}, _config = nil) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/wurk/sentry/error_handler.rb', line 32 def call(exception, context = {}, _config = nil) return nil unless Wurk::Sentry.enabled? return nil if exception.is_a?(Wurk::Shutdown) return nil if filtered?(exception) ::Sentry.capture_exception(exception, extra: extra_for(context), tags: (context)) nil end |
#filtered?(exception) ⇒ Boolean
41 42 43 44 45 |
# File 'lib/wurk/sentry/error_handler.rb', line 41 def filtered?(exception) return false unless @filter_transport_errors @filtered_error_classes.any? { |klass| exception.is_a?(klass) } end |