Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13992544
D7601.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7601.id.diff
View Options
Index: src/aphront/console/plugin/DarkConsoleServicesPlugin.php
===================================================================
--- src/aphront/console/plugin/DarkConsoleServicesPlugin.php
+++ src/aphront/console/plugin/DarkConsoleServicesPlugin.php
@@ -15,17 +15,36 @@
return 'Information about services.';
}
+ public static function getQueryAnalyzerHeader() {
+ return 'X-Phabricator-QueryAnalyzer';
+ }
+
+ public static function isQueryAnalyzerRequested() {
+ if (!empty($_REQUEST['__analyze__'])) {
+ return true;
+ }
+
+ $header = AphrontRequest::getHTTPHeader(self::getQueryAnalyzerHeader());
+ if ($header) {
+ return true;
+ }
+
+ return false;
+ }
+
/**
* @phutil-external-symbol class PhabricatorStartup
*/
public function generateData() {
+ $should_analyze = self::isQueryAnalyzerRequested();
+
$log = PhutilServiceProfiler::getInstance()->getServiceCallLog();
foreach ($log as $key => $entry) {
$config = idx($entry, 'config', array());
unset($log[$key]['config']);
- if (empty($_REQUEST['__analyze__'])) {
+ if (!$should_analyze) {
$log[$key]['explain'] = array(
'sev' => 7,
'size' => null,
@@ -139,7 +158,7 @@
'analyzeURI' => (string)$this
->getRequestURI()
->alter('__analyze__', true),
- 'didAnalyze' => isset($_REQUEST['__analyze__']),
+ 'didAnalyze' => $should_analyze,
);
}
Index: src/view/page/PhabricatorStandardPageView.php
===================================================================
--- src/view/page/PhabricatorStandardPageView.php
+++ src/view/page/PhabricatorStandardPageView.php
@@ -185,6 +185,9 @@
if (DarkConsoleXHProfPluginAPI::isProfilerStarted()) {
$headers[DarkConsoleXHProfPluginAPI::getProfilerHeader()] = 'page';
}
+ if (DarkConsoleServicesPlugin::isQueryAnalyzerRequested()) {
+ $headers[DarkConsoleServicesPlugin::getQueryAnalyzerHeader()] = true;
+ }
Javelin::initBehavior(
'dark-console',
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 23, 5:16 PM (3 w, 6 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6734271
Default Alt Text
D7601.id.diff (2 KB)
Attached To
Mode
D7601: Cascade DarkConsole query plan analyzer to Ajax requests
Attached
Detach File
Event Timeline
Log In to Comment