Class: Circuitbox::Notifier

Inherits:
Object
  • Object
show all
Defined in:
lib/circuitbox/notifier.rb

Instance Method Summary collapse

Constructor Details

#initialize(service, partition = nil) ⇒ Notifier

Returns a new instance of Notifier.



3
4
5
6
# File 'lib/circuitbox/notifier.rb', line 3

def initialize(service, partition=nil)
  @service   = service
  @partition = partition
end

Instance Method Details

#metric_gauge(gauge, value) ⇒ Object



18
19
20
21
# File 'lib/circuitbox/notifier.rb', line 18

def metric_gauge(gauge, value)
  return unless notification_available?
  ActiveSupport::Notifications.instrument("circuit_gauge", { circuit: circuit_name, gauge: gauge.to_s, value: value })
end

#notify(event) ⇒ Object



8
9
10
11
# File 'lib/circuitbox/notifier.rb', line 8

def notify(event)
  return unless notification_available?
  ActiveSupport::Notifications.instrument("circuit_#{event}", circuit: circuit_name)
end

#notify_warning(message) ⇒ Object



13
14
15
16
# File 'lib/circuitbox/notifier.rb', line 13

def notify_warning(message)
  return unless notification_available?
  ActiveSupport::Notifications.instrument("circuit_warning", { circuit: circuit_name, message: message})
end