Page MenuHomePhabricator

Remove 'profileoutput' debug channel from MediaWiki
Closed, ResolvedPublic

Description

When MediaWiki is in "debug profiling" mode (e.g. using XHProf or Tideways, such as at WMF via WikimediaDebug's "Inline profile" option), it will send the collected profile information the configured ProfilerOutput class.

For example:

  • ProfilerOutputText append the output as an HTML or JS comment to the HTTP response,
  • ProfilerOutputStats flushes each data point to Statsd/Graphite,
  • ProfilerOutputDump writes to an .xhprof file for viewing purposes in a GUI.

When any of these are enabled via wgProfiler, then MediaWiki will also do dump the whole Profiler output to a PSR-3/Monolog debug log channel called 'profileoutput'. As far as I know, this hasn't been used for many years. It predates our use of Monolog, and quite possibly was already unused even then.

I'm proposing we remove this to simplify the surrounding code and reduce core maintenance for Performance Team. Note that the functionality could be re-implemented in a much cleaner way by any interested third-parties by doing this from their own ProfilerOutput class.

For example:

use MediaWiki\Logger\LoggerFactory;
class ProfilerOutputPsr3 extends ProfilerOutput {
	public function log( array $stats ) {
		$logger = LoggerFactory::getInstance( 'profileoutput' );
		$logger->info( "Elapsed: {elapsed}; URL: <{url}>\n{output}", [
			'elapsed' => RequestContext::getMain()->getRequest()->getElapsedTime(),
			'url' => WebRequest::getGlobalRequestURL(),
			'output' => $this->collector->getOutput(),
		] );
	}
}

# To use:
# $wgProfiler['output'] = [ ProfilerOutputPsr3::class ];

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Note to self: Email wikitech.

Krinkle moved this task from Inbox to Doing (old) on the Performance-Team board.
Krinkle added a subscriber: aaron.
Krinkle triaged this task as Medium priority.Feb 27 2020, 4:12 PM
Krinkle updated the task description. (Show Details)

Change 575294 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] profiler: Remove support for $wgDebugLogGroups['profileoutput']

https://gerrit.wikimedia.org/r/575294

Change 575294 merged by jenkins-bot:
[mediawiki/core@master] profiler: Remove support for $wgDebugLogGroups['profileoutput']

https://gerrit.wikimedia.org/r/575294