@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Cascade DarkConsole query plan analyzer to Ajax requests

Summary: Fixes T4123. If you click "Profile" on a page, we already profile all the ajax requests it generates. Do the same for "Analyze Query Plans".

Test Plan: Viewed a page with Ajax requests using "Analyze Query Plans", and not using "Analyze Query Plans".

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T4123

Differential Revision: https://secure.phabricator.com/D7601

+24 -2
+21 -2
src/aphront/console/plugin/DarkConsoleServicesPlugin.php
··· 15 15 return 'Information about services.'; 16 16 } 17 17 18 + public static function getQueryAnalyzerHeader() { 19 + return 'X-Phabricator-QueryAnalyzer'; 20 + } 21 + 22 + public static function isQueryAnalyzerRequested() { 23 + if (!empty($_REQUEST['__analyze__'])) { 24 + return true; 25 + } 26 + 27 + $header = AphrontRequest::getHTTPHeader(self::getQueryAnalyzerHeader()); 28 + if ($header) { 29 + return true; 30 + } 31 + 32 + return false; 33 + } 34 + 18 35 /** 19 36 * @phutil-external-symbol class PhabricatorStartup 20 37 */ 21 38 public function generateData() { 39 + 40 + $should_analyze = self::isQueryAnalyzerRequested(); 22 41 23 42 $log = PhutilServiceProfiler::getInstance()->getServiceCallLog(); 24 43 foreach ($log as $key => $entry) { 25 44 $config = idx($entry, 'config', array()); 26 45 unset($log[$key]['config']); 27 46 28 - if (empty($_REQUEST['__analyze__'])) { 47 + if (!$should_analyze) { 29 48 $log[$key]['explain'] = array( 30 49 'sev' => 7, 31 50 'size' => null, ··· 139 158 'analyzeURI' => (string)$this 140 159 ->getRequestURI() 141 160 ->alter('__analyze__', true), 142 - 'didAnalyze' => isset($_REQUEST['__analyze__']), 161 + 'didAnalyze' => $should_analyze, 143 162 ); 144 163 } 145 164
+3
src/view/page/PhabricatorStandardPageView.php
··· 185 185 if (DarkConsoleXHProfPluginAPI::isProfilerStarted()) { 186 186 $headers[DarkConsoleXHProfPluginAPI::getProfilerHeader()] = 'page'; 187 187 } 188 + if (DarkConsoleServicesPlugin::isQueryAnalyzerRequested()) { 189 + $headers[DarkConsoleServicesPlugin::getQueryAnalyzerHeader()] = true; 190 + } 188 191 189 192 Javelin::initBehavior( 190 193 'dark-console',