Add timing information for commit hooks to push logs
Summary: Depends on D19779. Ref T13216. The push logs currently record the "hostWait", which is roughly "locking + subprocess cost". We also record locking separately, so we can figure out "subprocess cost" alone by subtracting the lock costs. However, the subprocess (normally `git receive-pack`) runs hooks, and we don't have an easy way to figure out how much time was spent doing actual `git` stuff vs spent doing commit hook processing. This would have been useful in diagnosing at least one recent issue. Track at least a rough hook cost and record it in the push logs. Test Plan: Pushed to a repository, saw a reasonable hook cost appear in the database table. Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13216 Differential Revision: https://secure.phabricator.com/D19780
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
// subclasses of PhabricatorConfigSiteSource to read it and build an instance
|
||||
// environment.
|
||||
|
||||
$hook_start = microtime(true);
|
||||
|
||||
if ($argc > 1) {
|
||||
$context = $argv[1];
|
||||
$context = explode(':', $context, 2);
|
||||
@@ -35,7 +37,8 @@ if ($argc < 2) {
|
||||
throw new Exception(pht('usage: commit-hook <repository>'));
|
||||
}
|
||||
|
||||
$engine = new DiffusionCommitHookEngine();
|
||||
$engine = id(new DiffusionCommitHookEngine())
|
||||
->setStartTime($hook_start);
|
||||
|
||||
$repository = id(new PhabricatorRepositoryQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
|
||||
Reference in New Issue
Block a user