2019-06-10 12:09:40 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Gitlab
|
|
|
|
module Cluster
|
|
|
|
class PumaWorkerKillerObserver
|
|
|
|
def initialize
|
|
|
|
@counter = Gitlab::Metrics.counter(:puma_killer_terminations_total, 'Number of workers terminated by PumaWorkerKiller')
|
|
|
|
end
|
|
|
|
|
|
|
|
# returns the Proc to be used as the observer callback block
|
|
|
|
def callback
|
|
|
|
method(:log_termination)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def log_termination(worker)
|
2019-08-12 06:16:25 -04:00
|
|
|
@counter.increment
|
2019-06-10 12:09:40 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|