use Psr\Log\LoggerAwareInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
-use WrappedString\WrappedString;
use Wikimedia\Rdbms\DBConnectionError;
+use Wikimedia\WrappedString;
/**
* Dynamic JavaScript and CSS resource loading system.
return $data;
}
- /* Methods */
-
/**
* Register core modules and runs registration hooks.
* @param Config $config [optional]
*
* @since 1.28
* @param ResourceLoaderContext $context
- * @param string[] $modules List of module names
* @return string Hash
*/
public function makeVersionQuery( ResourceLoaderContext $context ) {
// See https://bugs.php.net/bug.php?id=36514
ob_start();
+ $this->measureResponseTime( RequestContext::getMain()->getTiming() );
+
// Find out which modules are missing and instantiate the others
$modules = [];
$missing = [];
echo $response;
}
+ protected function measureResponseTime( Timing $timing ) {
+ DeferredUpdates::addCallableUpdate( function () use ( $timing ) {
+ $measure = $timing->measure( 'responseTime', 'requestStart', 'requestShutdown' );
+ if ( $measure !== false ) {
+ $stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
+ $stats->timing( 'resourceloader.responseTime', $measure['duration'] * 1000 );
+ }
+ } );
+ }
+
/**
* Send main response headers to the client.
*
return $moduleNames;
}
- /* Static Methods */
-
/**
* Return JS code that calls mw.loader.implement with given module properties.
*