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 15:36:05 +0200
commita4c8927007499d71a13e1a52c59a0ec36f20a6e0 (patch)
tree20b71dd0d8e0c19701cb6ad9a270ce1a0f0e18fc /lib/gitlab_shell.rb
parentb30d957fe2a85ee9ebb058010020e1c21d256a44 (diff)
downloadgitlab-shell-a4c8927007499d71a13e1a52c59a0ec36f20a6e0.tar.gz
Instrument GitLab Shell and log metrics data to a file
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..e243aac 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)