summaryrefslogtreecommitdiff
path: root/lib/gitlab_custom_hook.rb
diff options
context:
space:
mode:
authorAhmad Sherif <me@ahmadsherif.com>2016-11-16 14:09:33 +0200
committerAhmad Sherif <me@ahmadsherif.com>2016-11-16 14:10:56 +0200
commit79558da92f627da9e310160c89acdeba8b92b359 (patch)
treee1615fc13c36ccb3cf35edc18a90e60072fac7df /lib/gitlab_custom_hook.rb
parented59fbc3b72146cd9c4e040c64150c8b961c7d42 (diff)
downloadgitlab-shell-79558da92f627da9e310160c89acdeba8b92b359.tar.gz
Add instrumentation to push hooksmore-instrumentation-down-the-pipeline
Related to #22053
Diffstat (limited to 'lib/gitlab_custom_hook.rb')
-rw-r--r--lib/gitlab_custom_hook.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/gitlab_custom_hook.rb b/lib/gitlab_custom_hook.rb
index 4edb48b..6f2e901 100644
--- a/lib/gitlab_custom_hook.rb
+++ b/lib/gitlab_custom_hook.rb
@@ -1,4 +1,5 @@
require 'open3'
+require_relative 'gitlab_metrics'
class GitlabCustomHook
attr_reader :vars
@@ -11,21 +12,21 @@ class GitlabCustomHook
hook = hook_file('pre-receive', repo_path)
return true if hook.nil?
- call_receive_hook(hook, changes)
+ GitlabMetrics.measure("pre-receive-hook") { call_receive_hook(hook, changes) }
end
def post_receive(changes, repo_path)
hook = hook_file('post-receive', repo_path)
return true if hook.nil?
- call_receive_hook(hook, changes)
+ GitlabMetrics.measure("post-receive-hook") { call_receive_hook(hook, changes) }
end
def update(ref_name, old_value, new_value, repo_path)
hook = hook_file('update', repo_path)
return true if hook.nil?
- system(vars, hook, ref_name, old_value, new_value)
+ GitlabMetrics.measure("update-hook") { system(vars, hook, ref_name, old_value, new_value) }
end
private