Commit ce054552 authored by Eduardo Bonet's avatar Eduardo Bonet

Changes counter name, improves testing

parent 353924ef
...@@ -65,7 +65,7 @@ module Gitlab ...@@ -65,7 +65,7 @@ module Gitlab
def rendered_timeout def rendered_timeout
@rendered_timeout ||= Gitlab::Metrics.counter( @rendered_timeout ||= Gitlab::Metrics.counter(
:rendered_timeout, :ipynb_semantic_diff_timeouts_total,
'Counts the times notebook rendering timed out' 'Counts the times notebook rendering timed out'
) )
end end
...@@ -80,7 +80,7 @@ module Gitlab ...@@ -80,7 +80,7 @@ module Gitlab
def log_event(message, error = nil) def log_event(message, error = nil)
Gitlab::AppLogger.info({ message: message }) Gitlab::AppLogger.info({ message: message })
Gitlab::ErrorTracking.log_exception(error) if error Gitlab::ErrorTracking.track_exception(error) if error
nil nil
end end
end end
......
...@@ -53,8 +53,9 @@ RSpec.describe Gitlab::Diff::CustomDiff do ...@@ -53,8 +53,9 @@ RSpec.describe Gitlab::Diff::CustomDiff do
end end
it 'increments metrics' do it 'increments metrics' do
counter = Gitlab::Metrics.counter(:ipynb_semantic_diff_timeouts_total, 'desc')
expect(Timeout).to receive(:timeout).and_raise(Timeout::Error) expect(Timeout).to receive(:timeout).and_raise(Timeout::Error)
counter = Gitlab::Metrics.counter(:rendered_timeout, 'desc')
expect { subject }.to change { counter.get(source: described_class::FOREGROUND_EXECUTION) }.by(1) expect { subject }.to change { counter.get(source: described_class::FOREGROUND_EXECUTION) }.by(1)
end end
end end
...@@ -71,8 +72,9 @@ RSpec.describe Gitlab::Diff::CustomDiff do ...@@ -71,8 +72,9 @@ RSpec.describe Gitlab::Diff::CustomDiff do
end end
it 'increments metrics' do it 'increments metrics' do
counter = Gitlab::Metrics.counter(:ipynb_semantic_diff_timeouts_total, 'desc')
expect(Timeout).to receive(:timeout).and_raise(Timeout::Error) expect(Timeout).to receive(:timeout).and_raise(Timeout::Error)
counter = Gitlab::Metrics.counter(:rendered_timeout, 'desc')
expect { subject }.to change { counter.get(source: described_class::BACKGROUND_EXECUTION) }.by(1) expect { subject }.to change { counter.get(source: described_class::BACKGROUND_EXECUTION) }.by(1)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment