Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-07-18 02:34:27 +0300
committerStan Hu <stanhu@gmail.com>2019-07-18 16:53:39 +0300
commit1136c0c8e98d4f0d3fb4f50219657cabe0d45c99 (patch)
tree7c555a4d2fa9796cdcba2ac4de2514a974179f31 /lib/gitlab/git
parent037096ef6c2c2f804302efb429bcd1eb5123b5e9 (diff)
Add Rugged calls and duration to API and Rails logs
This adds `rugged_duration_ms` and `rugged_calls` fields to `api_json.log` and `production_json.log`. This will make it easier to identify performance issues caused by excessive I/O. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/64676
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r--lib/gitlab/git/rugged_impl/use_rugged.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/gitlab/git/rugged_impl/use_rugged.rb b/lib/gitlab/git/rugged_impl/use_rugged.rb
index 902fa3c7822..badf943e39c 100644
--- a/lib/gitlab/git/rugged_impl/use_rugged.rb
+++ b/lib/gitlab/git/rugged_impl/use_rugged.rb
@@ -13,7 +13,18 @@ module Gitlab
def wrap_rugged_call(&block)
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
- yield
+ start = Gitlab::Metrics::System.monotonic_time
+
+ result = yield
+
+ duration = Gitlab::Metrics::System.monotonic_time - start
+
+ if Gitlab::RuggedInstrumentation.active?
+ Gitlab::RuggedInstrumentation.increment_query_count
+ Gitlab::RuggedInstrumentation.query_time += duration
+ end
+
+ result
end
end
end