Fixed BufferingStatsdDataFactory::timing() callers to use ms
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 18 Aug 2015 20:20:39 +0000 (13:20 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 19 Aug 2015 01:01:49 +0000 (01:01 +0000)
* The interface actually demands this

Change-Id: I1e334c2696a8a8eca73a6ae7f71428190cad3107

includes/filerepo/file/File.php
includes/jobqueue/JobRunner.php
includes/objectcache/ObjectCacheSessionHandler.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderModule.php

index f9e1128..3677a14 100644 (file)
@@ -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;
        }
index 2465e5a..ac5a6fd 100644 (file)
@@ -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
index 6a9b9a8..2a5d695 100644 (file)
@@ -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;
        }
index 090c4fd..cecb6a2 100644 (file)
@@ -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 */";
                                }
index ade99e2..1243f23 100644 (file)
@@ -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;
        }