1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

In "Analyze Query Plans" mode, collect service call stack traces in DarkConsole

Summary: Ref T13106. When profiling service queries, there's no convenient way to easily get a sense of why a query was issued. Add a mode to collect traces for each query to make this more clear. This is rough, but works well enough to be useful.

Test Plan: Clicked "Analyze Query Plans", got stack traces for each service call.

Maniphest Tasks: T13106

Differential Revision: https://secure.phabricator.com/D19221
This commit is contained in:
epriestley 2018-03-14 10:55:08 -07:00
parent af8269d2fb
commit 2b5c73fc3d
3 changed files with 30 additions and 7 deletions

View file

@ -23,7 +23,7 @@ return array(
'rsrc/audio/basic/tap.mp3' => 'fc2fd796',
'rsrc/audio/basic/ting.mp3' => '17660001',
'rsrc/css/aphront/aphront-bars.css' => '231ac33c',
'rsrc/css/aphront/dark-console.css' => 'f7b071f1',
'rsrc/css/aphront/dark-console.css' => '0e14e8f6',
'rsrc/css/aphront/dialog-view.css' => '6bfc244b',
'rsrc/css/aphront/list-filter-view.css' => '5d6f0526',
'rsrc/css/aphront/multi-column.css' => '84cc6640',
@ -518,7 +518,7 @@ return array(
'symbols' => array(
'almanac-css' => 'dbb9b3af',
'aphront-bars' => '231ac33c',
'aphront-dark-console-css' => 'f7b071f1',
'aphront-dark-console-css' => '0e14e8f6',
'aphront-dialog-view-css' => '6bfc244b',
'aphront-list-filter-view-css' => '5d6f0526',
'aphront-multi-column-view-css' => '84cc6640',

View file

@ -29,6 +29,18 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
return false;
}
public function didStartup() {
$should_analyze = self::isQueryAnalyzerRequested();
if ($should_analyze) {
PhutilServiceProfiler::getInstance()
->setCollectStackTraces(true);
}
return null;
}
/**
* @phutil-external-symbol class PhabricatorStartup
*/
@ -266,6 +278,16 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
$info,
$analysis,
);
if ($row['trace']) {
$rows[] = array(
null,
null,
null,
$row['trace'],
null,
);
}
}
$table = new AphrontTableView($rows);
@ -274,7 +296,7 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin {
null,
'n',
'n',
'wide',
'wide prewrap',
'',
));
$table->setHeaders(

View file

@ -104,6 +104,7 @@
font-size: 11px;
background: #333333;
color: #ffffff;
border-bottom: 0px;
}
.dark-console .aphront-table-view td {
@ -210,10 +211,10 @@
}
.dark-console-panel-request-log-separator {
background-color: #e8e8e8;
border-bottom: 1px solid #b7b7b7;
border-top: 1px solid #b7b7b7;
height: 2px;
background-color: #e8e8e8;
border-bottom: 1px solid #b7b7b7;
border-top: 1px solid #b7b7b7;
height: 2px;
}
.dark-console-panel-ErrorLog {