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