diff --git a/lib/gitlab/metrics/samplers/ruby_sampler.rb b/lib/gitlab/metrics/samplers/ruby_sampler.rb index 3d29d38fa1fda12cc9313f5fc2b0ff101566205c..b1c5e9800dae3adc4a53c2fc61b7b9f0c0cb6545 100644 --- a/lib/gitlab/metrics/samplers/ruby_sampler.rb +++ b/lib/gitlab/metrics/samplers/ruby_sampler.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'prometheus/client/support/unicorn' - module Gitlab module Metrics module Samplers diff --git a/lib/prometheus/pid_provider.rb b/lib/prometheus/pid_provider.rb index 32beeb0d31ebda1cd983efb4a10144afbe165e05..d2563b4c806b2f45270abd4f5186092de6540a63 100644 --- a/lib/prometheus/pid_provider.rb +++ b/lib/prometheus/pid_provider.rb @@ -7,8 +7,6 @@ module PidProvider def worker_id if Gitlab::Runtime.sidekiq? sidekiq_worker_id - elsif Gitlab::Runtime.unicorn? - unicorn_worker_id elsif Gitlab::Runtime.puma? puma_worker_id else @@ -26,16 +24,6 @@ def sidekiq_worker_id end end - def unicorn_worker_id - if matches = process_name.match(/unicorn.*worker\[([0-9]+)\]/) - "unicorn_#{matches[1]}" - elsif process_name =~ /unicorn/ - "unicorn_master" - else - unknown_process_id - end - end - def puma_worker_id if matches = process_name.match(/puma.*cluster worker ([0-9]+):/) "puma_#{matches[1]}" diff --git a/spec/lib/prometheus/pid_provider_spec.rb b/spec/lib/prometheus/pid_provider_spec.rb index f1d7f2ffff55016676ee248183b1fd42536a6da0..9fdca2662e7d62569dbb60846de383d1e1ef23e9 100644 --- a/spec/lib/prometheus/pid_provider_spec.rb +++ b/spec/lib/prometheus/pid_provider_spec.rb @@ -28,66 +28,6 @@ end end - context 'when running in Unicorn mode' do - before do - allow(Gitlab::Runtime).to receive(:unicorn?).and_return(true) - - expect(described_class).to receive(:process_name) - .at_least(:once) - .and_return(process_name) - end - - context 'when unicorn master is specified in process name' do - context 'when running in Omnibus' do - context 'before the process was renamed' do - let(:process_name) { "/opt/gitlab/embedded/bin/unicorn"} - - it { is_expected.to eq 'unicorn_master' } - end - - context 'after the process was renamed' do - let(:process_name) { "unicorn master -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru" } - - it { is_expected.to eq 'unicorn_master' } - end - end - - context 'when in development env' do - context 'before the process was renamed' do - let(:process_name) { "path_to_bindir/bin/unicorn_rails"} - - it { is_expected.to eq 'unicorn_master' } - end - - context 'after the process was renamed' do - let(:process_name) { "unicorn_rails master -c /gitlab_dir/config/unicorn.rb -E development" } - - it { is_expected.to eq 'unicorn_master' } - end - end - end - - context 'when unicorn worker id is specified in process name' do - context 'when running in Omnibus' do - let(:process_name) { "unicorn worker[1] -D -E production -c /var/opt/gitlab/gitlab-rails/etc/unicorn.rb /opt/gitlab/embedded/service/gitlab-rails/config.ru" } - - it { is_expected.to eq 'unicorn_1' } - end - - context 'when in development env' do - let(:process_name) { "unicorn_rails worker[1] -c gitlab_dir/config/unicorn.rb -E development" } - - it { is_expected.to eq 'unicorn_1' } - end - end - - context 'when no specified unicorn master or worker id in process name' do - let(:process_name) { "bin/unknown_process"} - - it { is_expected.to eq "process_#{Process.pid}" } - end - end - context 'when running in Puma mode' do before do allow(Gitlab::Runtime).to receive(:puma?).and_return(true)