Class: Rearview::AlertsHandler
- Inherits:
-
Object
- Object
- Rearview::AlertsHandler
- Includes:
- Logger
- Defined in:
- lib/rearview/alerts_handler.rb
Instance Attribute Summary collapse
-
#job ⇒ Object
readonly
Returns the value of attribute job.
-
#monitor_result ⇒ Object
readonly
Returns the value of attribute monitor_result.
Instance Method Summary collapse
-
#initialize(job, monitor_results) ⇒ AlertsHandler
constructor
A new instance of AlertsHandler.
- #run ⇒ Object
- #to_s ⇒ Object
Methods included from Logger
Constructor Details
#initialize(job, monitor_results) ⇒ AlertsHandler
Returns a new instance of AlertsHandler.
6 7 8 9 |
# File 'lib/rearview/alerts_handler.rb', line 6 def initialize(job,monitor_results) @job = job @monitor_results = monitor_results end |
Instance Attribute Details
#job ⇒ Object (readonly)
Returns the value of attribute job.
5 6 7 |
# File 'lib/rearview/alerts_handler.rb', line 5 def job @job end |
#monitor_result ⇒ Object (readonly)
Returns the value of attribute monitor_result.
5 6 7 |
# File 'lib/rearview/alerts_handler.rb', line 5 def monitor_result @monitor_result end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rearview/alerts_handler.rb', line 10 def run logger.info "#{self} run" if Rearview.config.alerts_enabled? Rearview.alert_clients.each do |client| alert_agent = client.new begin alert_agent.alert(@job,@monitor_results) rescue logger.error "#{self} #{alert_agent} failed: #{$!}\n#{[email protected]("\n")}" end end end self rescue logger.error "#{self} failed: #{$!}\n#{[email protected]("\n")}" self end |
#to_s ⇒ Object
28 29 30 |
# File 'lib/rearview/alerts_handler.rb', line 28 def to_s "#{super.to_s} [jobId:#{@job.id} threadId:#{java.lang.Thread.currentThread.getId} threadName:#{java.lang.Thread.currentThread.getName}]" end |