Sha256: 17d09af0878992619e62503271b3885d86cad2592ed90e0aca0b4abc014a8170
Contents?: true
Size: 1020 Bytes
Versions: 82
Compression:
Stored size: 1020 Bytes
Contents
module Prometheus module Client module Support module Puma extend self def worker_pid_provider wid = worker_id if wid = worker_id wid else "process_id_#{Process.pid}" end end private def object_based_worker_id return unless defined?(::Puma::Cluster::Worker) workers = ObjectSpace.each_object(::Puma::Cluster::Worker) return if workers.nil? workers_first = workers.first workers_first.index unless workers_first.nil? end def program_name $PROGRAM_NAME end def worker_id if matchdata = program_name.match(/puma.*cluster worker ([0-9]+):/) "puma_#{matchdata[1]}" elsif object_worker_id = object_based_worker_id "puma_#{object_worker_id}" elsif program_name.include?('puma') 'puma_master' end end end end end end
Version data entries
82 entries across 82 versions & 2 rubygems