diff options
author | Stan Hu <stanhu@gmail.com> | 2019-04-12 22:54:32 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-04-17 04:45:24 -0700 |
commit | fbb3fd1397c1304d424da404c226e4a4f9aa262b (patch) | |
tree | 6ee45e4a54b4d67515dd3cccd3cd104517d48853 /lib | |
parent | b0c0f81d549165e69ca871f94ed0154e30a8970c (diff) | |
download | gitlab-ce-fbb3fd1397c1304d424da404c226e4a4f9aa262b.tar.gz |
Add backtrace to Gitaly performance bar
This adds the backtrace to a table to show exactly where the Gitaly call
was made to make it easier to understand where the call originated.
This change also collapses the details in the same row to improve the
usability when there is a backtrace.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/gitaly_client.rb | 13 | ||||
-rw-r--r-- | lib/gitlab/profiler.rb | 4 |
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index 35565b68388..726c4d95da9 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -165,7 +165,10 @@ module Gitlab current_transaction_labels.merge(gitaly_service: service.to_s, rpc: rpc.to_s), duration) - add_call_details(feature: "#{service}##{rpc}", duration: duration, request: request_hash, rpc: rpc) + if peek_enabled? + add_call_details(feature: "#{service}##{rpc}", duration: duration, request: request_hash, rpc: rpc, + backtrace: Gitlab::Profiler.clean_backtrace(caller)) + end end def self.query_time @@ -350,15 +353,17 @@ module Gitlab Gitlab::SafeRequestStore["gitaly_call_permitted"] = 0 end - def self.add_call_details(details) - return unless Gitlab::SafeRequestStore[:peek_enabled] + def self.peek_enabled? + Gitlab::SafeRequestStore[:peek_enabled] + end + def self.add_call_details(details) Gitlab::SafeRequestStore['gitaly_call_details'] ||= [] Gitlab::SafeRequestStore['gitaly_call_details'] << details end def self.list_call_details - return [] unless Gitlab::SafeRequestStore[:peek_enabled] + return [] unless peek_enabled? Gitlab::SafeRequestStore['gitaly_call_details'] || [] end diff --git a/lib/gitlab/profiler.rb b/lib/gitlab/profiler.rb index 93a9fcf1591..28ed587f5c7 100644 --- a/lib/gitlab/profiler.rb +++ b/lib/gitlab/profiler.rb @@ -16,7 +16,11 @@ module Gitlab ee/lib/gitlab/middleware/ lib/gitlab/performance_bar/ lib/gitlab/request_profiler/ + lib/gitlab/query_limiting/ + lib/gitlab/tracing/ lib/gitlab/profiler.rb + lib/gitlab/correlation_id.rb + lib/gitlab/webpack/dev_server_middleware.rb ].freeze # Takes a URL to profile (can be a fully-qualified URL, or an absolute path) |