diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-04-11 13:23:37 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-04-11 14:09:36 +0300 |
commit | 16926a676bdea4bfbbbaf9d390373073d2ff8bbd (patch) | |
tree | 3faba49dd9678474a603777a25501c0cf9ef8261 /spec/lib/gitlab/metrics_spec.rb | |
parent | 85279c07c9be889a25811a685110ab57a217651e (diff) |
Store block timings as transaction values
This makes it easier to query, simplifies the code, and makes it
possible to figure out what transaction the data belongs to (simply
because it's now stored _in_ the transaction).
This new setup keeps track of both the real/wall time _and_ CPU time
spent in a block, both measured using milliseconds (to keep all units
the same).
Diffstat (limited to 'spec/lib/gitlab/metrics_spec.rb')
-rw-r--r-- | spec/lib/gitlab/metrics_spec.rb | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/spec/lib/gitlab/metrics_spec.rb b/spec/lib/gitlab/metrics_spec.rb index 8f63a5f2043..edefec909c9 100644 --- a/spec/lib/gitlab/metrics_spec.rb +++ b/spec/lib/gitlab/metrics_spec.rb @@ -79,19 +79,13 @@ describe Gitlab::Metrics do 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(:add_metric). - with(:foo, values, { tag: 'value' }) + expect(transaction).to receive(:increment). + with('foo_cpu_time', a_kind_of(Numeric)) - Gitlab::Metrics.measure(:foo, { number: 10 }, tag: 'value') { 10 } + Gitlab::Metrics.measure(:foo) { 10 } end it 'returns the return value of the block' do |