Sha256: d55e083750851ee2357b47167f301be6f0c3cee1421a3d88b5f373cc0ae18cb1

Contents?: true

Size: 909 Bytes

Versions: 20

Compression:

Stored size: 909 Bytes

Contents

if defined?(Unicorn::WorkerKiller)
  Unicorn::WorkerKiller.module_eval do
    self.singleton_class.send(:alias_method, :kill_self_old, :kill_self)
    def self.kill_self(logger, start_time)
      self.kill_self_old(logger, start_time)
      if defined?(Prometheus)
        Prometheus::UNICORN_KILLS.set(1)
      else
        ZuoraConnect::AppInstance.write_to_telegraf(direction: 'Unicorn-Killer', tags: {app_instance: 0}, values: {kill: 1})
      end
    end
  end
end

if defined?(Unicorn::HttpServer) && defined?(Prometheus)
  module HttpServerExtensions
    def kill_worker(signal, wpid)
      Prometheus::UNICORN_KILLS.increment
      super
    end
  end

  module WorkerExtensions
    def soft_kill(sig)
      Prometheus::UNICORN_KILLS.increment
      super
    end
  end

  class Unicorn::HttpServer
    prepend HttpServerExtensions
  end

  class Unicorn::Worker
    prepend WorkerExtensions
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
zuora_connect-2.0.60v config/initializers/unicorn.rb
zuora_connect-2.0.60u config/initializers/unicorn.rb
zuora_connect-2.0.60t config/initializers/unicorn.rb
zuora_connect-2.0.60s config/initializers/unicorn.rb
zuora_connect-2.0.60r config/initializers/unicorn.rb
zuora_connect-2.0.60q config/initializers/unicorn.rb
zuora_connect-2.0.60p config/initializers/unicorn.rb
zuora_connect-2.0.60o config/initializers/unicorn.rb
zuora_connect-2.0.60n config/initializers/unicorn.rb
zuora_connect-2.0.60m config/initializers/unicorn.rb
zuora_connect-2.0.60l config/initializers/unicorn.rb
zuora_connect-2.0.60k config/initializers/unicorn.rb
zuora_connect-2.0.60j config/initializers/unicorn.rb
zuora_connect-2.0.60i config/initializers/unicorn.rb
zuora_connect-2.0.60h config/initializers/unicorn.rb
zuora_connect-2.0.60g config/initializers/unicorn.rb
zuora_connect-2.0.60f config/initializers/unicorn.rb
zuora_connect-2.0.60e config/initializers/unicorn.rb
zuora_connect-2.0.60d config/initializers/unicorn.rb
zuora_connect-2.0.60c config/initializers/unicorn.rb