module Prometheus::Client::Support::Unicorn
Public Class Methods
object_based_worker_id()
click to toggle source
# File lib/prometheus/client/support/unicorn.rb, line 23 def self.object_based_worker_id return unless defined?(::Unicorn::Worker) workers = ObjectSpace.each_object(::Unicorn::Worker) return if workers.nil? workers_first = workers.first workers_first.nr unless workers_first.nil? end
worker_id()
click to toggle source
# File lib/prometheus/client/support/unicorn.rb, line 14 def self.worker_id match = $0.match(/worker\[([^\]]+)\]/) if match match[1] else object_based_worker_id end end
worker_pid_provider()
click to toggle source
# File lib/prometheus/client/support/unicorn.rb, line 5 def self.worker_pid_provider wid = worker_id if wid.nil? "process_id_#{Process.pid}" else "worker_id_#{wid}" end end