2019-07-21 05:34:46 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Peek
|
|
|
|
module Views
|
2019-07-24 14:42:45 +00:00
|
|
|
class Rugged < DetailedView
|
|
|
|
def results
|
|
|
|
return {} unless calls > 0
|
|
|
|
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2019-07-21 05:34:46 +00:00
|
|
|
def duration
|
|
|
|
::Gitlab::RuggedInstrumentation.query_time
|
|
|
|
end
|
|
|
|
|
|
|
|
def calls
|
|
|
|
::Gitlab::RuggedInstrumentation.query_count
|
|
|
|
end
|
|
|
|
|
2019-07-24 14:42:45 +00:00
|
|
|
def call_details
|
2019-07-21 05:34:46 +00:00
|
|
|
::Gitlab::RuggedInstrumentation.list_call_details
|
|
|
|
end
|
|
|
|
|
|
|
|
def format_call_details(call)
|
2019-07-26 13:03:00 +00:00
|
|
|
super.merge(args: format_args(call[:args]))
|
2019-07-21 05:34:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def format_args(args)
|
|
|
|
args.map do |arg|
|
|
|
|
# Needed to avoid infinite as_json calls
|
|
|
|
if arg.is_a?(Gitlab::Git::Repository)
|
|
|
|
arg.to_s
|
|
|
|
else
|
|
|
|
arg
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|