Commit f48f1396 authored by Quang-Minh Nguyen's avatar Quang-Minh Nguyen

Add start time to Gitaly items in the performance bar

Issue https://gitlab.com/groups/gitlab-org/-/epics/5590
parent c9b65766
......@@ -50,11 +50,11 @@ module Gitlab
end
def recording_request
start = Gitlab::Metrics::System.monotonic_time
@start = Gitlab::Metrics::System.monotonic_time
yield
ensure
@duration += Gitlab::Metrics::System.monotonic_time - start
@duration += Gitlab::Metrics::System.monotonic_time - @start
end
def store_timings
......@@ -64,8 +64,14 @@ module Gitlab
request_hash = @request.is_a?(Google::Protobuf::MessageExts) ? @request.to_h : {}
GitalyClient.add_call_details(feature: "#{@service}##{@rpc}", duration: @duration, request: request_hash, rpc: @rpc,
backtrace: Gitlab::BacktraceCleaner.clean_backtrace(caller))
GitalyClient.add_call_details(
start: @start,
feature: "#{@service}##{@rpc}",
duration: @duration,
request: request_hash,
rpc: @rpc,
backtrace: Gitlab::BacktraceCleaner.clean_backtrace(caller)
)
end
end
end
......
......@@ -24,11 +24,14 @@ RSpec.describe Gitlab::GitalyClient::Call do
def expect_call_details_to_match(duration_higher_than: 0)
expect(client.list_call_details.size).to eq(1)
expect(client.list_call_details.first)
.to match a_hash_including(feature: "#{service}##{rpc}",
duration: a_value > duration_higher_than,
request: an_instance_of(Hash),
rpc: rpc,
backtrace: an_instance_of(Array))
.to match a_hash_including(
start: a_value > 0,
feature: "#{service}##{rpc}",
duration: a_value > duration_higher_than,
request: an_instance_of(Hash),
rpc: rpc,
backtrace: an_instance_of(Array)
)
end
context 'when the response is not an enumerator' do
......
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