summaryrefslogtreecommitdiff
path: root/lib/gitlab_shell.rb
diff options
context:
space:
mode:
authorPaco Guzman <pacoguzmanp@gmail.com>2016-10-10 14:21:28 +0200
committerPaco Guzman <pacoguzmanp@gmail.com>2016-10-11 13:15:28 +0200
commitba44420a2184476fb4c76b3b797b5d1e3e714c8a (patch)
tree9af1b29e5a14497e7c632880c8a04efe08655f24 /lib/gitlab_shell.rb
parentb30d957fe2a85ee9ebb058010020e1c21d256a44 (diff)
downloadgitlab-shell-62-instrument-gitlab-shell.tar.gz
Instrument GitLab Shell and log metrics data to a file62-instrument-gitlab-shell
Diffstat (limited to 'lib/gitlab_shell.rb')
-rw-r--r--lib/gitlab_shell.rb13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index f72ce74..ad2cc50 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -2,6 +2,7 @@ require 'shellwords'
require 'pathname'
require_relative 'gitlab_net'
+require_relative 'gitlab_metrics'
class GitlabShell
class AccessDeniedError < StandardError; end
@@ -32,7 +33,9 @@ class GitlabShell
args = Shellwords.shellwords(origin_cmd)
parse_cmd(args)
- verify_access if GIT_COMMANDS.include?(args.first)
+ if GIT_COMMANDS.include?(args.first)
+ GitlabMetrics.measure('verify_access') { verify_access }
+ end
process_cmd(args)
@@ -118,11 +121,11 @@ class GitlabShell
$logger.info "gitlab-shell: executing git-annex command <#{parsed_args.join(' ')}> for #{log_username}."
exec_cmd(*parsed_args)
-
elsif @command == 'git-lfs-authenticate'
- $logger.info "gitlab-shell: Processing LFS authentication for #{log_username}."
- lfs_authenticate
-
+ GitlabMetrics.measure('lfs_authenticate') do
+ $logger.info "gitlab-shell: Processing LFS authentication for #{log_username}."
+ lfs_authenticate
+ end
else
$logger.info "gitlab-shell: executing git command <#{@command} #{repo_path}> for #{log_username}."
exec_cmd(@command, repo_path)