diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 15:06:20 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-10-22 15:06:20 +0300 |
commit | b1bcdba89bc241e2cede910f26cf3f5fff8d7901 (patch) | |
tree | 41b45ec9ff1ba56c93b29b00435495e7e5abf02b /lib/prometheus | |
parent | 30dc5b50569db30fef06cc7ab66e7341161b3c70 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/prometheus')
-rw-r--r-- | lib/prometheus/pid_provider.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/prometheus/pid_provider.rb b/lib/prometheus/pid_provider.rb index e0f7e7e0a9e..228639357ac 100644 --- a/lib/prometheus/pid_provider.rb +++ b/lib/prometheus/pid_provider.rb @@ -6,7 +6,7 @@ module Prometheus def worker_id if Sidekiq.server? - 'sidekiq' + sidekiq_worker_id elsif defined?(Unicorn::Worker) unicorn_worker_id elsif defined?(::Puma) @@ -18,6 +18,14 @@ module Prometheus private + def sidekiq_worker_id + if worker = ENV['SIDEKIQ_WORKER_ID'] + "sidekiq_#{worker}" + else + 'sidekiq' + end + end + def unicorn_worker_id if matches = process_name.match(/unicorn.*worker\[([0-9]+)\]/) "unicorn_#{matches[1]}" |