Module: Prometheus::Client::Support::Unicorn
- Defined in:
- lib/prometheus/client/support/unicorn.rb
Class Method Summary collapse
Class Method Details
.object_based_worker_id ⇒ Object
23 24 25 26 27 28 29 30 31 |
# 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 ⇒ Object
14 15 16 17 18 19 20 21 |
# 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 ⇒ Object
5 6 7 8 9 10 11 12 |
# 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 |