mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 14:52:40 +01:00
Log slow linters using service call
Summary: Following @epriestley suggestion to use PhutilServiceProfiler to log lint as a service call Test Plan: arc lint Reviewers: vrana CC: phunt, aran, epriestley Differential Revision: https://secure.phabricator.com/D4820
This commit is contained in:
parent
7a67173b97
commit
8be64ec4c6
2 changed files with 15 additions and 1 deletions
|
@ -161,6 +161,7 @@ phutil_register_library_map(array(
|
|||
'PhutilLintEngine' => 'lint/engine/PhutilLintEngine.php',
|
||||
'PhutilUnitTestEngine' => 'unit/engine/PhutilUnitTestEngine.php',
|
||||
'PhutilUnitTestEngineTestCase' => 'unit/engine/__tests__/PhutilUnitTestEngineTestCase.php',
|
||||
'TimerEventType' => 'events/constant/TimerEventType.php',
|
||||
'UnitTestableArcanistLintEngine' => 'lint/engine/UnitTestableArcanistLintEngine.php',
|
||||
),
|
||||
'function' =>
|
||||
|
@ -288,6 +289,7 @@ phutil_register_library_map(array(
|
|||
'PhutilLintEngine' => 'ArcanistLintEngine',
|
||||
'PhutilUnitTestEngine' => 'ArcanistBaseUnitTestEngine',
|
||||
'PhutilUnitTestEngineTestCase' => 'ArcanistTestCase',
|
||||
'TimerEventType' => 'PhutilEventType',
|
||||
'UnitTestableArcanistLintEngine' => 'ArcanistLintEngine',
|
||||
),
|
||||
));
|
||||
|
|
|
@ -230,9 +230,21 @@ abstract class ArcanistLintEngine {
|
|||
|
||||
if ($paths) {
|
||||
$linter->willLintPaths($paths);
|
||||
$profiler = PhutilServiceProfiler::getInstance();
|
||||
foreach ($paths as $path) {
|
||||
$linter->willLintPath($path);
|
||||
$linter->lintPath($path);
|
||||
$call_id = $profiler->beginServiceCall(array(
|
||||
'type' => 'lint',
|
||||
'linter' => get_class($linter),
|
||||
'path' => $path,
|
||||
));
|
||||
try {
|
||||
$linter->lintPath($path);
|
||||
} catch (Exception $ex) {
|
||||
$profiler->endServiceCall($call_id, array());
|
||||
throw $ex;
|
||||
}
|
||||
$profiler->endServiceCall($call_id, array());
|
||||
if ($linter->didStopAllLinters()) {
|
||||
$this->stopped[$path] = $linter_name;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue