Sha256: ef926e10c121ef0c40b3af17eedff46f77ed02f31a8de35cb596b7a09ab14771

Contents?: true

Size: 788 Bytes

Versions: 188

Compression:

Stored size: 788 Bytes

Contents

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

        def self.worker_id
          match = $0.match(/worker\[([^\]]+)\]/)
          if match
            match[1]
          else
            object_based_worker_id
          end
        end

        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
      end
    end
  end
end

Version data entries

188 entries across 188 versions & 2 rubygems

Version Path
prometheus-client-mmap-1.2.4-x86_64-linux-musl lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.4-x86_64-linux-gnu lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.4-x86_64-darwin lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.4-arm64-darwin lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.4-aarch64-linux-musl lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.4-aarch64-linux-gnu lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.1 lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.1-x86_64-linux lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.1-x86_64-linux-musl lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.1-x86_64-darwin lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.1-arm64-darwin lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.1-aarch64-linux lib/prometheus/client/support/unicorn.rb
prometheus-client-mmap-1.2.1-aarch64-linux-musl lib/prometheus/client/support/unicorn.rb
vinted-prometheus-client-mmap-1.7.0 lib/prometheus/client/support/unicorn.rb
vinted-prometheus-client-mmap-1.7.0-x86_64-linux lib/prometheus/client/support/unicorn.rb
vinted-prometheus-client-mmap-1.6.0 lib/prometheus/client/support/unicorn.rb
vinted-prometheus-client-mmap-1.6.0-x86_64-linux lib/prometheus/client/support/unicorn.rb
vinted-prometheus-client-mmap-1.5.0-x86_64-linux lib/prometheus/client/support/unicorn.rb
vinted-prometheus-client-mmap-1.4.0 lib/prometheus/client/support/unicorn.rb
vinted-prometheus-client-mmap-1.3.0 lib/prometheus/client/support/unicorn.rb