Sha256: c8a326b1a492934f6fa6e4b3ba794922e897140e03aa37b37bd9bcf63c71c7a0

Contents?: true

Size: 910 Bytes

Versions: 69

Compression:

Stored size: 910 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

69 entries across 69 versions & 1 rubygems

Version Path
zuora_connect-3.2.10 config/initializers/unicorn.rb
zuora_connect-3.2.9 config/initializers/unicorn.rb
zuora_connect-3.2.8 config/initializers/unicorn.rb
zuora_connect-3.2.7 config/initializers/unicorn.rb
zuora_connect-3.2.6 config/initializers/unicorn.rb
zuora_connect-3.2.5 config/initializers/unicorn.rb
zuora_connect-3.2.4 config/initializers/unicorn.rb
zuora_connect-3.2.3 config/initializers/unicorn.rb
zuora_connect-3.2.2 config/initializers/unicorn.rb
zuora_connect-3.2.0 config/initializers/unicorn.rb
zuora_connect-3.1.5.pre.g config/initializers/unicorn.rb
zuora_connect-3.1.5.pre.f config/initializers/unicorn.rb
zuora_connect-3.1.5.pre.e config/initializers/unicorn.rb
zuora_connect-3.1.5.pre.d config/initializers/unicorn.rb
zuora_connect-3.1.5.pre.c config/initializers/unicorn.rb
zuora_connect-3.1.5.pre.b config/initializers/unicorn.rb
zuora_connect-3.1.5.pre.a config/initializers/unicorn.rb
zuora_connect-3.1.5 config/initializers/unicorn.rb
zuora_connect-3.1.4 config/initializers/unicorn.rb
zuora_connect-3.1.3 config/initializers/unicorn.rb