From 4f0b16b914c7f0bd4e05dc169ffe5b991301fb87 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 18 Aug 2015 13:20:39 -0700 Subject: [PATCH] Fixed BufferingStatsdDataFactory::timing() callers to use ms * The interface actually demands this Change-Id: I1e334c2696a8a8eca73a6ae7f71428190cad3107 --- includes/filerepo/file/File.php | 16 ++++++++++------ includes/jobqueue/JobRunner.php | 4 ++-- .../objectcache/ObjectCacheSessionHandler.php | 6 +++--- includes/resourceloader/ResourceLoader.php | 3 ++- includes/resourceloader/ResourceLoaderModule.php | 4 ++-- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/includes/filerepo/file/File.php b/includes/filerepo/file/File.php index f9e1128a8e..3677a14b97 100644 --- a/includes/filerepo/file/File.php +++ b/includes/filerepo/file/File.php @@ -423,7 +423,10 @@ abstract class File implements IDBAccessObject { if ( !isset( $this->fsFile ) ) { $starttime = microtime( true ); $this->fsFile = $this->repo->getLocalReference( $this->getPath() ); - RequestContext::getMain()->getStats()->timing( 'media.thumbnail.generate.fetchoriginal', microtime( true ) - $starttime ); + + $statTiming = microtime( true ) - $starttime; + RequestContext::getMain()->getStats()->timing( + 'media.thumbnail.generate.fetchoriginal', 1000 * $statTiming ); if ( !$this->fsFile ) { $this->fsFile = false; // null => false; cache negative hits @@ -1120,7 +1123,8 @@ abstract class File implements IDBAccessObject { $thumb = $handler->doTransform( $this, $tmpThumbPath, $thumbUrl, $transformParams ); $tmpFile->bind( $thumb ); // keep alive with $thumb - $stats->timing( 'media.thumbnail.generate.transform', microtime( true ) - $starttime ); + $statTiming = microtime( true ) - $starttime; + $stats->timing( 'media.thumbnail.generate.transform', 1000 * $statTiming ); if ( !$thumb ) { // bad params? $thumb = false; @@ -1143,7 +1147,8 @@ abstract class File implements IDBAccessObject { $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $transformParams, $flags ); } - $stats->timing( 'media.thumbnail.generate.store', microtime( true ) - $starttime ); + $statTiming = microtime( true ) - $starttime; + $stats->timing( 'media.thumbnail.generate.store', 1000 * $statTiming ); // Give extensions a chance to do something with this thumbnail... Hooks::run( 'FileTransformed', array( $this, $thumb, $tmpThumbPath, $thumbPath ) ); @@ -1180,8 +1185,6 @@ abstract class File implements IDBAccessObject { $params = $this->getHandler()->sanitizeParamsForBucketing( $params ); - $bucketName = $this->getBucketThumbName( $bucket ); - $tmpFile = $this->makeTransformTmpFile( $bucketPath ); if ( !$tmpFile ) { @@ -1201,7 +1204,8 @@ abstract class File implements IDBAccessObject { // this object exists $tmpFile->bind( $this ); - RequestContext::getMain()->getStats()->timing( 'media.thumbnail.generate.bucket', $buckettime ); + RequestContext::getMain()->getStats()->timing( + 'media.thumbnail.generate.bucket', 1000 * $buckettime ); return true; } diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php index 2465e5aed7..ac5a6fde22 100644 --- a/includes/jobqueue/JobRunner.php +++ b/includes/jobqueue/JobRunner.php @@ -203,8 +203,8 @@ class JobRunner implements LoggerAwareInterface { if ( $readyTs ) { // Record time to run for the job type $pickupDelay = $popTime - $readyTs; - $stats->timing( 'jobqueue.pickup_delay.all', $pickupDelay ); - $stats->timing( "jobqueue.pickup_delay.$jType", $pickupDelay ); + $stats->timing( 'jobqueue.pickup_delay.all', 1000 * $pickupDelay ); + $stats->timing( "jobqueue.pickup_delay.$jType", 1000 * $pickupDelay ); } // Mark the job as done on success or when the job cannot be retried diff --git a/includes/objectcache/ObjectCacheSessionHandler.php b/includes/objectcache/ObjectCacheSessionHandler.php index 6a9b9a87b5..2a5d69556f 100644 --- a/includes/objectcache/ObjectCacheSessionHandler.php +++ b/includes/objectcache/ObjectCacheSessionHandler.php @@ -112,7 +112,7 @@ class ObjectCacheSessionHandler { $data = self::getCache()->get( self::getKey( $id ) ); $real = microtime( true ) - $stime; - RequestContext::getMain()->getStats()->timing( "session.read", $real ); + RequestContext::getMain()->getStats()->timing( "session.read", 1000 * $real ); self::$hashCache = array( $id => self::getHash( $data ) ); @@ -137,7 +137,7 @@ class ObjectCacheSessionHandler { self::getCache()->set( self::getKey( $id ), $data, $wgObjectCacheSessionExpiry ); $real = microtime( true ) - $stime; - RequestContext::getMain()->getStats()->timing( "session.write", $real ); + RequestContext::getMain()->getStats()->timing( "session.write", 1000 * $real ); } return true; @@ -154,7 +154,7 @@ class ObjectCacheSessionHandler { self::getCache()->delete( self::getKey( $id ) ); $real = microtime( true ) - $stime; - RequestContext::getMain()->getStats()->timing( "session.destroy", $real ); + RequestContext::getMain()->getStats()->timing( "session.destroy", 1000 * $real ); return true; } diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 090c4fda9f..cecb6a2706 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -221,7 +221,8 @@ class ResourceLoader implements LoggerAwareInterface { $result = self::applyFilter( $filter, $data, $this->config ); - $stats->timing( "resourceloader_cache.$filter.miss", microtime( true ) - $statStart ); + $statTiming = microtime( true ) - $statStart; + $stats->timing( "resourceloader_cache.$filter.miss", 1000 * $statTiming ); if ( $options['cacheReport'] ) { $result .= "\n/* cache key: $key */"; } diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index ade99e2303..1243f23131 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -572,8 +572,8 @@ abstract class ResourceLoaderModule { $statTiming = microtime( true ) - $statStart; $statName = strtr( $this->getName(), '.', '_' ); - $stats->timing( "resourceloader_build.all", $statTiming ); - $stats->timing( "resourceloader_build.$statName", $statTiming ); + $stats->timing( "resourceloader_build.all", 1000 * $statTiming ); + $stats->timing( "resourceloader_build.$statName", 1000 * $statTiming ); return $content; } -- 2.20.1