diff options
| author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-04-11 13:16:58 +0000 |
|---|---|---|
| committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-04-11 13:16:58 +0000 |
| commit | 15cbbd09fbd05cfd2447dfb43d66d7a96a708f82 (patch) | |
| tree | 57709a15309392056e5c232d76efc749a5805c5e /spec | |
| parent | 5999fec7a3aa7f663d0ade254e37fda3391fa17a (diff) | |
| parent | 7eed4608fe5adf65d6a29ef50c93485ca2e6806f (diff) | |
| download | gitlab-ce-15cbbd09fbd05cfd2447dfb43d66d7a96a708f82.tar.gz | |
Merge branch 'metrics-measure-block-transaction' into 'master'
Store block timings as transaction values
See merge request !3649
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/lib/gitlab/metrics/system_spec.rb | 6 | ||||
| -rw-r--r-- | spec/lib/gitlab/metrics_spec.rb | 19 |
2 files changed, 14 insertions, 11 deletions
diff --git a/spec/lib/gitlab/metrics/system_spec.rb b/spec/lib/gitlab/metrics/system_spec.rb index f8c1d956ca1..d6ae54e25e8 100644 --- a/spec/lib/gitlab/metrics/system_spec.rb +++ b/spec/lib/gitlab/metrics/system_spec.rb @@ -26,4 +26,10 @@ describe Gitlab::Metrics::System do end end end + + describe '.cpu_time' do + it 'returns a Fixnum' do + expect(described_class.cpu_time).to be_an_instance_of(Fixnum) + end + end end diff --git a/spec/lib/gitlab/metrics_spec.rb b/spec/lib/gitlab/metrics_spec.rb index 8f63a5f2043..3dee13e27f4 100644 --- a/spec/lib/gitlab/metrics_spec.rb +++ b/spec/lib/gitlab/metrics_spec.rb @@ -74,24 +74,21 @@ describe Gitlab::Metrics do let(:transaction) { Gitlab::Metrics::Transaction.new } before do - allow(Gitlab::Metrics::Transaction).to receive(:current). + allow(Gitlab::Metrics).to receive(:current_transaction). and_return(transaction) end it 'adds a metric to the current transaction' do - expect(transaction).to receive(:add_metric). - with(:foo, { duration: a_kind_of(Numeric) }, { tag: 'value' }) + expect(transaction).to receive(:increment). + with('foo_real_time', a_kind_of(Numeric)) - Gitlab::Metrics.measure(:foo, {}, tag: 'value') { 10 } - end - - it 'supports adding of custom values' do - values = { duration: a_kind_of(Numeric), number: 10 } + expect(transaction).to receive(:increment). + with('foo_cpu_time', a_kind_of(Numeric)) - expect(transaction).to receive(:add_metric). - with(:foo, values, { tag: 'value' }) + expect(transaction).to receive(:increment). + with('foo_call_count', 1) - Gitlab::Metrics.measure(:foo, { number: 10 }, tag: 'value') { 10 } + Gitlab::Metrics.measure(:foo) { 10 } end it 'returns the return value of the block' do |
