diff options
| author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-10-12 16:10:47 +0200 |
|---|---|---|
| committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-10-12 16:11:50 +0200 |
| commit | 1d68fefe5016baa61043e72ba7ee5458eded8634 (patch) | |
| tree | e40a001e12b025cf5934e9393c4baa17a35e9990 /spec | |
| parent | 3cba0e6ea6d30e9faca7727b66eb9ddfe5b5b51c (diff) | |
| download | gitlab-shell-1d68fefe5016baa61043e72ba7ee5458eded8634.tar.gz | |
Re-use the default logger for performance metrics
This removes the need for configuring anything extra. To make scraping
easier each line is prefixed by "metrics:".
Fixes #64
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/gitlab_metrics_spec.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/spec/gitlab_metrics_spec.rb b/spec/gitlab_metrics_spec.rb index 885fa3b..07be670 100644 --- a/spec/gitlab_metrics_spec.rb +++ b/spec/gitlab_metrics_spec.rb @@ -2,22 +2,18 @@ require_relative 'spec_helper' require_relative '../lib/gitlab_metrics' describe GitlabMetrics do - describe '::measure' do + describe '.measure' do it 'returns the return value of the block' do val = described_class.measure('foo') { 10 } expect(val).to eq(10) end - it 'write in a file metrics data' do - result = nil - expect(described_class.logger).to receive(:debug) do |&b| - result = b.call - end + it 'writes the metrics data to a log file' do + expect(described_class.logger).to receive(:debug). + with(/metrics: name=\"foo\" wall_time=\d+ cpu_time=\d+/) described_class.measure('foo') { 10 } - - expect(result).to match(/name=\"foo\" wall_time=\d+ cpu_time=\d+/) end it 'calls proper measure methods' do |
