diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 12:26:25 +0000 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /lib/gitlab/gitaly_client.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) | |
download | gitlab-ce-a09983ae35713f5a2bbb100981116d31ce99826e.tar.gz |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'lib/gitlab/gitaly_client.rb')
-rw-r--r-- | lib/gitlab/gitaly_client.rb | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index bed99ef0ed4..b284aadc107 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -166,20 +166,7 @@ module Gitlab # "gitaly-2 is at network address tcp://10.0.1.2:8075". # def self.call(storage, service, rpc, request, remote_storage: nil, timeout: default_timeout, &block) - self.measure_timings(service, rpc, request) do - self.execute(storage, service, rpc, request, remote_storage: remote_storage, timeout: timeout, &block) - end - end - - # This method is like GitalyClient.call but should be used with - # Gitaly streaming RPCs. It measures how long the the RPC took to - # produce the full response, not just the initial response. - def self.streaming_call(storage, service, rpc, request, remote_storage: nil, timeout: default_timeout) - self.measure_timings(service, rpc, request) do - response = self.execute(storage, service, rpc, request, remote_storage: remote_storage, timeout: timeout) - - yield(response) - end + Gitlab::GitalyClient::Call.new(storage, service, rpc, request, remote_storage, timeout).call(&block) end def self.execute(storage, service, rpc, request, remote_storage:, timeout:) @@ -192,23 +179,6 @@ module Gitlab stub(service, storage).__send__(rpc, request, kwargs) # rubocop:disable GitlabSecurity/PublicSend end - def self.measure_timings(service, rpc, request) - start = Gitlab::Metrics::System.monotonic_time - - yield - ensure - duration = Gitlab::Metrics::System.monotonic_time - start - request_hash = request.is_a?(Google::Protobuf::MessageExts) ? request.to_h : {} - - # Keep track, separately, for the performance bar - self.add_query_time(duration) - - if Gitlab::PerformanceBar.enabled_for_request? - add_call_details(feature: "#{service}##{rpc}", duration: duration, request: request_hash, rpc: rpc, - backtrace: Gitlab::BacktraceCleaner.clean_backtrace(caller)) - end - end - def self.query_time query_time = Gitlab::SafeRequestStore[:gitaly_query_time] || 0 query_time.round(Gitlab::InstrumentationHelper::DURATION_PRECISION) |