mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-02-17 01:08: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',
|
'PhutilLintEngine' => 'lint/engine/PhutilLintEngine.php',
|
||||||
'PhutilUnitTestEngine' => 'unit/engine/PhutilUnitTestEngine.php',
|
'PhutilUnitTestEngine' => 'unit/engine/PhutilUnitTestEngine.php',
|
||||||
'PhutilUnitTestEngineTestCase' => 'unit/engine/__tests__/PhutilUnitTestEngineTestCase.php',
|
'PhutilUnitTestEngineTestCase' => 'unit/engine/__tests__/PhutilUnitTestEngineTestCase.php',
|
||||||
|
'TimerEventType' => 'events/constant/TimerEventType.php',
|
||||||
'UnitTestableArcanistLintEngine' => 'lint/engine/UnitTestableArcanistLintEngine.php',
|
'UnitTestableArcanistLintEngine' => 'lint/engine/UnitTestableArcanistLintEngine.php',
|
||||||
),
|
),
|
||||||
'function' =>
|
'function' =>
|
||||||
|
@ -288,6 +289,7 @@ phutil_register_library_map(array(
|
||||||
'PhutilLintEngine' => 'ArcanistLintEngine',
|
'PhutilLintEngine' => 'ArcanistLintEngine',
|
||||||
'PhutilUnitTestEngine' => 'ArcanistBaseUnitTestEngine',
|
'PhutilUnitTestEngine' => 'ArcanistBaseUnitTestEngine',
|
||||||
'PhutilUnitTestEngineTestCase' => 'ArcanistTestCase',
|
'PhutilUnitTestEngineTestCase' => 'ArcanistTestCase',
|
||||||
|
'TimerEventType' => 'PhutilEventType',
|
||||||
'UnitTestableArcanistLintEngine' => 'ArcanistLintEngine',
|
'UnitTestableArcanistLintEngine' => 'ArcanistLintEngine',
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
|
|
|
@ -230,9 +230,21 @@ abstract class ArcanistLintEngine {
|
||||||
|
|
||||||
if ($paths) {
|
if ($paths) {
|
||||||
$linter->willLintPaths($paths);
|
$linter->willLintPaths($paths);
|
||||||
|
$profiler = PhutilServiceProfiler::getInstance();
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
$linter->willLintPath($path);
|
$linter->willLintPath($path);
|
||||||
|
$call_id = $profiler->beginServiceCall(array(
|
||||||
|
'type' => 'lint',
|
||||||
|
'linter' => get_class($linter),
|
||||||
|
'path' => $path,
|
||||||
|
));
|
||||||
|
try {
|
||||||
$linter->lintPath($path);
|
$linter->lintPath($path);
|
||||||
|
} catch (Exception $ex) {
|
||||||
|
$profiler->endServiceCall($call_id, array());
|
||||||
|
throw $ex;
|
||||||
|
}
|
||||||
|
$profiler->endServiceCall($call_id, array());
|
||||||
if ($linter->didStopAllLinters()) {
|
if ($linter->didStopAllLinters()) {
|
||||||
$this->stopped[$path] = $linter_name;
|
$this->stopped[$path] = $linter_name;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue