diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-06-04 09:11:55 +0000 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2019-06-04 09:11:55 +0000 |
commit | d4a83ce5a3f8bc6024091e3c75d81ce3fa413a56 (patch) | |
tree | 420e1ae2ed359a85cd04d07b366cc93b32f04919 /lib/gitlab/metrics/samplers/puma_sampler.rb | |
parent | 5915dec667713ae4c7f4685bdefceb92ef446076 (diff) | |
download | gitlab-ce-d4a83ce5a3f8bc6024091e3c75d81ce3fa413a56.tar.gz |
Ignore Puma empty worker stats
In some cases (during worker start) it's possible that
Puma.stats returns an empty hash for worker's last status. In
that case we just skip sampling of the worker until these
stats are available.
Diffstat (limited to 'lib/gitlab/metrics/samplers/puma_sampler.rb')
-rw-r--r-- | lib/gitlab/metrics/samplers/puma_sampler.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/metrics/samplers/puma_sampler.rb b/lib/gitlab/metrics/samplers/puma_sampler.rb index 87669b253bc..25e40c70230 100644 --- a/lib/gitlab/metrics/samplers/puma_sampler.rb +++ b/lib/gitlab/metrics/samplers/puma_sampler.rb @@ -51,10 +51,11 @@ module Gitlab set_master_metrics(stats) stats['worker_status'].each do |worker| + last_status = worker['last_status'] labels = { worker: "worker_#{worker['index']}" } metrics[:puma_phase].set(labels, worker['phase']) - set_worker_metrics(worker['last_status'], labels) + set_worker_metrics(last_status, labels) if last_status.present? end end |