Sha256: a55eece9d95ea65d47db89273301810b0b932cf00f17b32389822850177dce58

Contents?: true

Size: 623 Bytes

Versions: 3

Compression:

Stored size: 623 Bytes

Contents

module Prometheus
  module Client
    module Support
      module Unicorn
        def self.worker_pid_provider
          wid = worker_id
          wid = Process.pid if wid.nil?
          if wid.nil?
            "process_pid_#{Process.pid}"
          else
            "worker_id_#{wid}"
          end
        end

        def self.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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prometheus-client-mmap-0.7.0.beta17 lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-0.7.0.beta16 lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-0.7.0.beta15 lib/prometheus/client/support/unicorn.rb