BigW Consortium Gitlab

Commit b452d57e by Winnie Hellmann

Merge branch 'pawel/update-prometheus_gem_to_highly_optimized_version-10-2' into…

Merge branch 'pawel/update-prometheus_gem_to_highly_optimized_version-10-2' into '10-2-stable-patch-5' Update prometheus-client-mmap gem to highly optimized version (10.2 port) See merge request gitlab-org/gitlab-ce!15928
parents 4552bb43 11d1876f
...@@ -20,7 +20,7 @@ class MetricsService ...@@ -20,7 +20,7 @@ class MetricsService
end end
def metrics_text def metrics_text
"#{health_metrics_text}#{prometheus_metrics_text}" prometheus_metrics_text.concat(health_metrics_text)
end end
private private
......
...@@ -11,15 +11,7 @@ Prometheus::Client.configure do |config| ...@@ -11,15 +11,7 @@ Prometheus::Client.configure do |config|
config.multiprocess_files_dir ||= Rails.root.join('tmp/prometheus_multiproc_dir') config.multiprocess_files_dir ||= Rails.root.join('tmp/prometheus_multiproc_dir')
end end
config.pid_provider = -> do config.pid_provider = Prometheus::Client::Support::Unicorn.method(:worker_pid_provider)
wid = Prometheus::Client::Support::Unicorn.worker_id
wid = Process.pid if wid.nil?
if wid.nil?
"process_pid_#{Process.pid}"
else
"worker_id_#{wid}"
end
end
end end
Sidekiq.configure_server do |config| Sidekiq.configure_server do |config|
......
...@@ -32,7 +32,7 @@ module Gitlab ...@@ -32,7 +32,7 @@ module Gitlab
def init_metrics def init_metrics
metrics = {} metrics = {}
metrics[:sampler_duration] = Metrics.histogram(with_prefix(:sampler_duration, :seconds), 'Sampler time', {}) metrics[:sampler_duration] = Metrics.histogram(with_prefix(:sampler_duration, :seconds), 'Sampler time', { worker: nil })
metrics[:total_time] = Metrics.gauge(with_prefix(:gc, :time_total), 'Total GC time', labels, :livesum) metrics[:total_time] = Metrics.gauge(with_prefix(:gc, :time_total), 'Total GC time', labels, :livesum)
GC.stat.keys.each do |key| GC.stat.keys.each do |key|
metrics[key] = Metrics.gauge(with_prefix(:gc, key), to_doc_string(key), labels, :livesum) metrics[key] = Metrics.gauge(with_prefix(:gc, key), to_doc_string(key), labels, :livesum)
...@@ -99,9 +99,9 @@ module Gitlab ...@@ -99,9 +99,9 @@ module Gitlab
worker_no = ::Prometheus::Client::Support::Unicorn.worker_id worker_no = ::Prometheus::Client::Support::Unicorn.worker_id
if worker_no if worker_no
{ unicorn: worker_no } { worker: worker_no }
else else
{ unicorn: 'master' } { worker: 'master' }
end end
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment