Track object count types as tags

This commit is contained in:
Yorick Peterse 2015-12-10 17:48:14 +01:00
parent 6dc25ad58c
commit 09a311568a
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -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