diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2017-12-11 18:57:17 +0300 |
---|---|---|
committer | LUKE BENNETT <lbennett@gitlab.com> | 2017-12-13 16:55:29 +0300 |
commit | ced708d39e580e6427e742a4f3f9d634c0d90f33 (patch) | |
tree | b87ebf88a3a7a31adb3c0b6865a7b74423a63157 /lib | |
parent | 5d076319c68543d1428b4c8b6f64edec6d272e02 (diff) |
Merge branch 'sh-remove-allocation-tracking-influxdb' into 'master'
Remove allocation tracking code from InfluxDB sampler for performance
Closes gitlab-com/infrastructure#3250
See merge request gitlab-org/gitlab-ce!15834
(cherry picked from commit 3daa7331397d0b565911d5bb67b2411b021136fa)
e1a8e5a5 Remove allocation tracking code from InfluxDB sampler for performance
10f5446c Remove RubySampler#sample_objects for performance as well
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/metrics/samplers/influx_sampler.rb | 24 | ||||
-rw-r--r-- | lib/gitlab/metrics/samplers/ruby_sampler.rb | 27 |
2 files changed, 0 insertions, 51 deletions
diff --git a/lib/gitlab/metrics/samplers/influx_sampler.rb b/lib/gitlab/metrics/samplers/influx_sampler.rb index f4f9b5ca792..5a0f7f28fc8 100644 --- a/lib/gitlab/metrics/samplers/influx_sampler.rb +++ b/lib/gitlab/metrics/samplers/influx_sampler.rb @@ -27,7 +27,6 @@ module Gitlab def sample sample_memory_usage sample_file_descriptors - sample_objects sample_gc flush @@ -48,29 +47,6 @@ module Gitlab add_metric('file_descriptors', value: System.file_descriptor_count) end - if Metrics.mri? - def sample_objects - sample = Allocations.to_hash - counts = sample.each_with_object({}) do |(klass, count), hash| - name = klass.name - - next unless name - - hash[name] = count - end - - # Symbols aren't allocated so we'll need to add those manually. - counts['Symbol'] = Symbol.all_symbols.length - - counts.each do |name, count| - add_metric('object_counts', { count: count }, type: name) - end - end - else - def sample_objects - end - end - def sample_gc time = GC::Profiler.total_time * 1000.0 stats = GC.stat.merge(total_time: time) diff --git a/lib/gitlab/metrics/samplers/ruby_sampler.rb b/lib/gitlab/metrics/samplers/ruby_sampler.rb index f4901be9581..b68800417a2 100644 --- a/lib/gitlab/metrics/samplers/ruby_sampler.rb +++ b/lib/gitlab/metrics/samplers/ruby_sampler.rb @@ -48,7 +48,6 @@ module Gitlab def sample start_time = System.monotonic_time sample_gc - sample_objects metrics[:memory_usage].set(labels, System.memory_usage) metrics[:file_descriptors].set(labels, System.file_descriptor_count) @@ -68,32 +67,6 @@ module Gitlab end end - def sample_objects - list_objects.each do |name, count| - metrics[:objects_total].set(labels.merge(class: name), count) - end - end - - if Metrics.mri? - def list_objects - sample = Allocations.to_hash - counts = sample.each_with_object({}) do |(klass, count), hash| - name = klass.name - - next unless name - - hash[name] = count - end - - # Symbols aren't allocated so we'll need to add those manually. - counts['Symbol'] = Symbol.all_symbols.length - counts - end - else - def list_objects - end - end - def worker_label return {} unless defined?(Unicorn::Worker) |