Switched job run time profiling to context getStats()
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 15 Aug 2015 21:29:39 +0000 (14:29 -0700)
committerOri.livneh <ori@wikimedia.org>
Wed, 19 Aug 2015 20:21:29 +0000 (20:21 +0000)
* This replaces the scoped profiling calls

Change-Id: I73caffad0e0d31d9ffbd3c0decfe31e17ea85398

includes/jobqueue/JobRunner.php

index ac5a6fd..700a63d 100644 (file)
@@ -109,10 +109,8 @@ class JobRunner implements LoggerAwareInterface {
                        return $response;
                }
 
-               $profiler = Profiler::instance();
-
                // Catch huge single updates that lead to slave lag
-               $trxProfiler = $profiler->getTransactionProfiler();
+               $trxProfiler = Profiler::instance()->getTransactionProfiler();
                $trxProfiler->setLogger( LoggerFactory::getInstance( 'DBPerformance' ) );
                $trxProfiler->setExpectations( $wgTrxProfilerLimits['JobRunner'], __METHOD__ );
 
@@ -176,7 +174,6 @@ class JobRunner implements LoggerAwareInterface {
                                $this->debugCallback( $msg );
 
                                // Run the job...
-                               $psection = $profiler->scopedProfileIn( __METHOD__ . '-' . $jType );
                                $jobStartTime = microtime( true );
                                try {
                                        ++$jobsPopped;
@@ -197,7 +194,6 @@ class JobRunner implements LoggerAwareInterface {
                                wfGetLBFactory()->commitAll();
                                $timeMs = intval( ( microtime( true ) - $jobStartTime ) * 1000 );
                                $timeMsTotal += $timeMs;
-                               $profiler->scopedProfileOut( $psection );
 
                                $readyTs = $job->getReadyTimestamp();
                                if ( $readyTs ) {
@@ -206,6 +202,7 @@ class JobRunner implements LoggerAwareInterface {
                                        $stats->timing( 'jobqueue.pickup_delay.all', 1000 * $pickupDelay );
                                        $stats->timing( "jobqueue.pickup_delay.$jType", 1000 * $pickupDelay );
                                }
+                               $stats->timing( "jobqueue.run.$jType", $timeMs );
 
                                // Mark the job as done on success or when the job cannot be retried
                                if ( $status !== false || !$job->allowRetries() ) {