Commit 3eafb563 authored by Stan Hu's avatar Stan Hu

Fix Gitaly duration timings for ApplyBfgObjectMapStreamRequest

Previously the `gitaly_duration_s` log timings only accounted for the
initial request/response time. We now measure the total time it takes to
consume the streaming response for this RPC to complete.

Part of https://gitlab.com/gitlab-org/gitlab/-/issues/30334
parent d800c3d3
...@@ -13,15 +13,15 @@ module Gitlab ...@@ -13,15 +13,15 @@ module Gitlab
end end
def apply_bfg_object_map_stream(io, &blk) def apply_bfg_object_map_stream(io, &blk)
responses = GitalyClient.call( GitalyClient.streaming_call(
storage, storage,
:cleanup_service, :cleanup_service,
:apply_bfg_object_map_stream, :apply_bfg_object_map_stream,
build_object_map_enum(io), build_object_map_enum(io),
timeout: GitalyClient.long_timeout timeout: GitalyClient.long_timeout
) ) do |response|
response.each(&blk)
responses.each(&blk) end
end end
private private
......
...@@ -22,5 +22,11 @@ describe Gitlab::GitalyClient::CleanupService do ...@@ -22,5 +22,11 @@ describe Gitlab::GitalyClient::CleanupService do
client.apply_bfg_object_map_stream(StringIO.new) client.apply_bfg_object_map_stream(StringIO.new)
end end
it 'is wrapped as a streaming call' do
expect(Gitlab::GitalyClient).to receive(:streaming_call).with(anything, :cleanup_service, :apply_bfg_object_map_stream, anything, anything)
client.apply_bfg_object_map_stream(StringIO.new)
end
end end
end end
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