diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-07-18 18:43:37 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-07-18 18:43:37 +0300 |
commit | 090ca4f7e3910b5711e570dfa2bbaa68532a28ba (patch) | |
tree | fedf2ec579e9bdcbafb7073aee63dd5f456964ee /lib/gitlab/git | |
parent | 2044473dad12e925df4dda22bfef44418f045af4 (diff) | |
parent | 1136c0c8e98d4f0d3fb4f50219657cabe0d45c99 (diff) |
Merge branch 'sh-add-rugged-logs' into 'master'
Add Rugged calls and duration to API and Rails logs
Closes #64676
See merge request gitlab-org/gitlab-ce!30871
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r-- | lib/gitlab/git/rugged_impl/use_rugged.rb | 13 |
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 |