Class: Yes::Core::FailedSubscriptionNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/yes/core/failed_subscription_notifier.rb

Overview

Reports a permanently dead pg_eventstore subscription to Sentry.

pg_eventstore calls its failed_subscription_notifier exactly once, when a subscription exhausts its restarts and stays dead — it is the gem's only death signal, and without it that death is silent. Per-failure errors are only recorded on the subscription row, never raised into Sentry.

Instance Method Summary collapse

Instance Method Details

#call(subscription, error) ⇒ void

This method returns an undefined value.

Parameters:

  • subscription (PgEventstore::Subscription)
  • error (StandardError)


15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/yes/core/failed_subscription_notifier.rb', line 15

def call(subscription, error)
  Sentry.with_scope do |scope|
    scope.set_tags(failed_subscription_notifier: true) # used in Sentry Alerts

    Sentry.capture_exception(
      error,
      # a death report must never be swallowed by Sentry's excluded_exceptions
      hint: { ignore_exclusions: true },
      extra: { id: subscription.id, set: subscription.set, name: subscription.name }
    )
  end
end