summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksei Lipniagov <alipniagov@gitlab.com>2019-07-29 13:35:14 +0300
committerAleksei Lipniagov <alipniagov@gitlab.com>2019-07-29 13:35:14 +0300
commit671cc69f87298c6ecf23d844b5b91f017db23e99 (patch)
tree72d342a22bfedc583ba6308e3c66c47f1ff45a82
parent8833912b9ee8df52e69984f464c6e4e1a2dd8b09 (diff)
downloadgitlab-ce-671cc69f87298c6ecf23d844b5b91f017db23e99.tar.gz
WIP: add debug prints
-rw-r--r--config/initializers/zz_metrics.rb1
-rw-r--r--lib/gitlab/metrics/samplers/ruby_sampler.rb10
2 files changed, 11 insertions, 0 deletions
diff --git a/config/initializers/zz_metrics.rb b/config/initializers/zz_metrics.rb
index b005fdf159b..db34e677538 100644
--- a/config/initializers/zz_metrics.rb
+++ b/config/initializers/zz_metrics.rb
@@ -135,6 +135,7 @@ end
# In development mode, we turn off eager loading when we're running
# `rails generate migration` because eager loading short-circuits the
# loading of our custom migration templates.
+p "-1. ZZ_METRICS: $0=#{$0}, expr=#{Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && defined?(Rails::Generators))}"
if Gitlab::Metrics.enabled? && !Rails.env.test? && !(Rails.env.development? && defined?(Rails::Generators))
require 'pathname'
require 'influxdb'
diff --git a/lib/gitlab/metrics/samplers/ruby_sampler.rb b/lib/gitlab/metrics/samplers/ruby_sampler.rb
index 575884caed6..a3a7ac9e06a 100644
--- a/lib/gitlab/metrics/samplers/ruby_sampler.rb
+++ b/lib/gitlab/metrics/samplers/ruby_sampler.rb
@@ -52,6 +52,7 @@ module Gitlab
end
def sample
+ p "---> 0. SAMPLE: #{$0}"
start_time = System.monotonic_time
metrics[:file_descriptors].set(labels, System.file_descriptor_count)
@@ -68,11 +69,20 @@ module Gitlab
# TODO: move most of the logic to a separate class
def sample_gc
current_gc_count = GC.stat[:count]
+ p "---> 1.CURRENT_GC_COUNT: #{current_gc_count}"
new_events_since_last_sample = current_gc_count - @last_gc_count
+ p "---> 2.NEW_EVENTS_SINCE_LAST_SAMPLE: #{new_events_since_last_sample}"
+ p "#{GC::Profiler}"
+ p "#{GC::Profiler.enabled?}"
+ p "#{GC::Profiler.raw_data}"
+ p "#{GC::Profiler.raw_data.class}"
profiled_events = GC::Profiler.raw_data.count
+ p "---> 3.PROFILED_EVENTS: #{profiled_events}"
lost_profiled_events = new_events_since_last_sample - profiled_events
+ p "---> 4.LOST_PROFILED_EVENTS: #{lost_profiled_events}"
+
unless lost_profiled_events.zero?
ruby_gc_lost_profile_events.increment(lost_profiled_events)
end