Hide Rugged data if it doesn't exist

This commit is contained in:
Stan Hu 2019-07-23 22:12:42 -07:00
parent 291df05e43
commit 02a2793725
2 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,8 @@ module Peek
end
def results
return {} unless calls > 0
{
duration: formatted_duration,
calls: calls,

View File

@ -11,6 +11,10 @@ describe Peek::Views::Rugged, :request_store do
allow(Gitlab::RuggedInstrumentation).to receive(:peek_enabled?).and_return(true)
end
it 'returns no results' do
expect(subject.results).to eq({})
end
it 'returns aggregated results' do
::Gitlab::RuggedInstrumentation.query_time += 1.234
::Gitlab::RuggedInstrumentation.increment_query_count