summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2015-12-10 17:48:14 +0100
committerYorick Peterse <yorickpeterse@gmail.com>2015-12-17 17:25:48 +0100
commit09a311568abee739fae0c2577a9cf6aa01516977 (patch)
treea7fbb356ca2f1adf57e7238c8c5d91ebdad623ce
parent6dc25ad58c7bf2218cdda6d60061111a5365affb (diff)
downloadgitlab-ce-09a311568abee739fae0c2577a9cf6aa01516977.tar.gz
Track object count types as tags
-rw-r--r--lib/gitlab/metrics/sampler.rb4
-rw-r--r--spec/lib/gitlab/metrics/sampler_spec.rb3
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab/metrics/sampler.rb b/lib/gitlab/metrics/sampler.rb
index 141953dc985..03afa6324dd 100644
--- a/lib/gitlab/metrics/sampler.rb
+++ b/lib/gitlab/metrics/sampler.rb
@@ -53,7 +53,9 @@ module Gitlab
end
def sample_objects
- @metrics << Metric.new('object_counts', ObjectSpace.count_objects)
+ ObjectSpace.count_objects.each do |type, count|
+ @metrics << Metric.new('object_counts', { count: count }, type: type)
+ end
end
def sample_gc
diff --git a/spec/lib/gitlab/metrics/sampler_spec.rb b/spec/lib/gitlab/metrics/sampler_spec.rb
index b486d38870f..319f287178d 100644
--- a/spec/lib/gitlab/metrics/sampler_spec.rb
+++ b/spec/lib/gitlab/metrics/sampler_spec.rb
@@ -71,7 +71,8 @@ describe Gitlab::Metrics::Sampler do
describe '#sample_objects' do
it 'adds a metric containing the amount of allocated objects' do
expect(Gitlab::Metrics::Metric).to receive(:new).
- with('object_counts', an_instance_of(Hash)).
+ with('object_counts', an_instance_of(Hash), an_instance_of(Hash)).
+ at_least(:once).
and_call_original
sampler.sample_objects