Revert "Count API and hook calls, with 1:1000 sampling"
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 21 Aug 2015 19:35:48 +0000 (19:35 +0000)
committerOri.livneh <ori@wikimedia.org>
Fri, 21 Aug 2015 20:22:05 +0000 (20:22 +0000)
This seems to use 3.67% of index.php real time per xenon.

This reverts commit c4cd2399390f7922c88bb521c39bfbefe000338e.

Change-Id: I1eb8dfc72036493e430271f0db3f2f2f96b149c3

includes/Hooks.php
includes/api/ApiMain.php
includes/api/ApiQuery.php

index c726538..036d65c 100644 (file)
@@ -135,10 +135,6 @@ class Hooks {
         *   returning null) is equivalent to returning true.
         */
        public static function run( $event, array $args = array(), $deprecatedVersion = null ) {
-               $stats = RequestContext::getMain()->getStats();
-               $metric = $stats->increment( 'hooks.' . $event );
-               $metric->setSampleRate( 0.001 );
-
                foreach ( self::getHandlers( $event ) as $hook ) {
                        // Turn non-array values into an array. (Can't use casting because of objects.)
                        if ( !is_array( $hook ) ) {
index 8ce505a..f2059d7 100644 (file)
@@ -1089,14 +1089,8 @@ class ApiMain extends ApiBase {
 
                $this->checkAsserts( $params );
 
-               $stats = $this->getContext()->getStats();
-               $statsPath = 'api.modules.' . strtr( $module->getModulePath(), '+', '.' );
-               $metric = $stats->increment( $statsPath );
-               $metric->setSampleRate( 0.001 );
-
                // Execute
                $module->execute();
-
                Hooks::run( 'APIAfterExecute', array( &$module ) );
 
                $this->reportUnusedParams();
index 8959a46..5378e92 100644 (file)
@@ -276,7 +276,6 @@ class ApiQuery extends ApiBase {
                }
 
                $cacheMode = $this->mPageSet->getCacheMode();
-               $stats =  $this->getContext()->getStats();
 
                // Execute all unfinished modules
                /** @var $module ApiQueryBase */
@@ -284,11 +283,6 @@ class ApiQuery extends ApiBase {
                        $params = $module->extractRequestParams();
                        $cacheMode = $this->mergeCacheMode(
                                $cacheMode, $module->getCacheMode( $params ) );
-
-                       $statsPath = 'api.modules.' . strtr( $module->getModulePath(), '+', '.' );
-                       $metric = $stats->increment( $statsPath );
-                       $metric->setSampleRate( 0.001 );
-
                        $module->execute();
                        Hooks::run( 'APIQueryAfterExecute', array( &$module ) );
                }