Commit 02a27937 authored by Stan Hu's avatar Stan Hu

Hide Rugged data if it doesn't exist

parent 291df05e
...@@ -12,6 +12,8 @@ module Peek ...@@ -12,6 +12,8 @@ module Peek
end end
def results def results
return {} unless calls > 0
{ {
duration: formatted_duration, duration: formatted_duration,
calls: calls, calls: calls,
......
...@@ -11,6 +11,10 @@ describe Peek::Views::Rugged, :request_store do ...@@ -11,6 +11,10 @@ describe Peek::Views::Rugged, :request_store do
allow(Gitlab::RuggedInstrumentation).to receive(:peek_enabled?).and_return(true) allow(Gitlab::RuggedInstrumentation).to receive(:peek_enabled?).and_return(true)
end end
it 'returns no results' do
expect(subject.results).to eq({})
end
it 'returns aggregated results' do it 'returns aggregated results' do
::Gitlab::RuggedInstrumentation.query_time += 1.234 ::Gitlab::RuggedInstrumentation.query_time += 1.234
::Gitlab::RuggedInstrumentation.increment_query_count ::Gitlab::RuggedInstrumentation.increment_query_count
......
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