Class: StandardCircuit::Notifiers::Sentry
- Inherits:
-
Object
- Object
- StandardCircuit::Notifiers::Sentry
- Defined in:
- lib/standard_circuit/notifiers/sentry.rb
Overview
Subscribes to standard_circuit.circuit.opened and forwards a warning-level message to Sentry. Other transitions are ignored — only RED matters for alerting.
Instance Method Summary collapse
Instance Method Details
#call(event_name, payload) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/standard_circuit/notifiers/sentry.rb', line 7 def call(event_name, payload) return unless event_name == "standard_circuit.circuit.opened" return unless defined?(::Sentry) && ::Sentry.respond_to?(:capture_message) = "Circuit breaker opened: #{payload[:circuit]}" ::Sentry.( , level: :warning, extra: { circuit: payload[:circuit], from_color: payload[:from_color], to_color: payload[:to_color], error_class: payload[:error_class], error_message: payload[:error_message] }.compact ) end |