Sha256: fc48b2f589a0fa290e9cbbfac28bfbce949abbff55ba2228a2dbf568497c001f

Contents?: true

Size: 862 Bytes

Versions: 15

Compression:

Stored size: 862 Bytes

Contents

module Rearview
  class AlertsHandler
    include Rearview::Logger
    attr_reader :job,:monitor_result
    def initialize(job,monitor_results)
      @job = job
      @monitor_results = monitor_results
    end
    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#{$@.join("\n")}"
          end
        end
      end
      self
    rescue
      logger.error "#{self} failed: #{$!}\n#{$@.join("\n")}"
      self
    end

    def to_s
      "#{super.to_s} [jobId:#{@job.id} threadId:#{java.lang.Thread.currentThread.getId} threadName:#{java.lang.Thread.currentThread.getName}]"
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
rearview-1.0.3.rc.3-jruby lib/rearview/alerts_handler.rb
rearview-1.0.3.rc.2-jruby lib/rearview/alerts_handler.rb
rearview-1.0.3.rc.1-jruby lib/rearview/alerts_handler.rb
rearview-1.0.2-jruby lib/rearview/alerts_handler.rb
rearview-1.0.2.rc.4-jruby lib/rearview/alerts_handler.rb
rearview-1.0.2.rc.3-jruby lib/rearview/alerts_handler.rb
rearview-1.0.2.rc.2-jruby lib/rearview/alerts_handler.rb
rearview-1.0.2.rc.1-jruby lib/rearview/alerts_handler.rb
rearview-1.0.1-jruby lib/rearview/alerts_handler.rb
rearview-1.0.0-jruby lib/rearview/alerts_handler.rb
rearview-1.0.0.rc5-jruby lib/rearview/alerts_handler.rb
rearview-1.0.0.rc4-jruby lib/rearview/alerts_handler.rb
rearview-1.0.0.rc3-jruby lib/rearview/alerts_handler.rb
rearview-1.0.0.rc2-jruby lib/rearview/alerts_handler.rb
rearview-1.0.0.rc1-jruby lib/rearview/alerts_handler.rb