http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83628

Revision: 83628
Author:   tstarling
Date:     2011-03-10 02:18:55 +0000 (Thu, 10 Mar 2011)
Log Message:
-----------
MFT r83617: job queue stats

Modified Paths:
--------------
    branches/wmf/1.17wmf1/includes/DefaultSettings.php
    branches/wmf/1.17wmf1/includes/GlobalFunctions.php
    branches/wmf/1.17wmf1/includes/job/JobQueue.php

Property Changed:
----------------
    branches/wmf/1.17wmf1/includes/DefaultSettings.php
    branches/wmf/1.17wmf1/includes/GlobalFunctions.php
    branches/wmf/1.17wmf1/includes/job/JobQueue.php

Modified: branches/wmf/1.17wmf1/includes/DefaultSettings.php
===================================================================
--- branches/wmf/1.17wmf1/includes/DefaultSettings.php  2011-03-10 01:58:25 UTC 
(rev 83627)
+++ branches/wmf/1.17wmf1/includes/DefaultSettings.php  2011-03-10 02:18:55 UTC 
(rev 83628)
@@ -3871,6 +3871,14 @@
  */
 $wgStatsMethod = 'cache';
 
+/**
+ * When $wgStatsMethod is 'udp', setting this to a string allows statistics to 
+ * be aggregated over more than one wiki. The string will be used in place of
+ * the DB name in outgoing UDP packets. If this is set to false, the DB name
+ * will be used.
+ */
+$wgAggregateStatsID = false;
+
 /** Whereas to count the number of time an article is viewed.
  * Does not work if pages are cached (for example with squid).
  */


Property changes on: branches/wmf/1.17wmf1/includes/DefaultSettings.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/DefaultSettings.php:51646
/branches/REL1_17/phase3/includes/DefaultSettings.php:81654
/branches/new-installer/phase3/includes/DefaultSettings.php:43664-66004
/branches/sqlite/includes/DefaultSettings.php:58211-58321
/branches/wmf/1.16wmf4/includes/DefaultSettings.php:67177,69199,76243,77266
/branches/wmf-deployment/includes/DefaultSettings.php:53381,60970
/trunk/phase3/includes/DefaultSettings.php:78395,79166,79324,79746,79860,79968,80109,80113,80137-80138,80205,80210,80222-80223,80231,80272,80381,80432-80433,80436,80443,80475,80554,80575,80590,80614-80616,80620,80656,80666,80837,80841,81311,81313,81349,81352,81376,81389,81397,81399,81412,81430,81488,81496,81554,81561,81589,81600,81611-81612,81615,81620,81622,81640,81648,81650-81652,81657,81674,81689,82696,82836,82853,82858,83114,83270,83284,83374,83390,83392,83402-83403,83410-83411,83420,83461,83463,83512
   + /branches/REL1_15/phase3/includes/DefaultSettings.php:51646
/branches/REL1_17/phase3/includes/DefaultSettings.php:81654
/branches/new-installer/phase3/includes/DefaultSettings.php:43664-66004
/branches/sqlite/includes/DefaultSettings.php:58211-58321
/branches/wmf/1.16wmf4/includes/DefaultSettings.php:67177,69199,76243,77266
/branches/wmf-deployment/includes/DefaultSettings.php:53381,60970
/trunk/phase3/includes/DefaultSettings.php:78395,79166,79324,79746,79860,79968,80109,80113,80137-80138,80205,80210,80222-80223,80231,80272,80381,80432-80433,80436,80443,80475,80554,80575,80590,80614-80616,80620,80656,80666,80837,80841,81311,81313,81349,81352,81376,81389,81397,81399,81412,81430,81488,81496,81554,81561,81589,81600,81611-81612,81615,81620,81622,81640,81648,81650-81652,81657,81674,81689,82696,82836,82853,82858,83114,83270,83284,83374,83390,83392,83402-83403,83410-83411,83420,83461,83463,83512,83617

Modified: branches/wmf/1.17wmf1/includes/GlobalFunctions.php
===================================================================
--- branches/wmf/1.17wmf1/includes/GlobalFunctions.php  2011-03-10 01:58:25 UTC 
(rev 83627)
+++ branches/wmf/1.17wmf1/includes/GlobalFunctions.php  2011-03-10 02:18:55 UTC 
(rev 83628)
@@ -2322,15 +2322,20 @@
 /**
  * Increment a statistics counter
  */
-function wfIncrStats( $key ) {
+function wfIncrStats( $key, $count = 1 ) {
        global $wgStatsMethod;
 
+       $count = intval( $count );
+
        if( $wgStatsMethod == 'udp' ) {
-               global $wgUDPProfilerHost, $wgUDPProfilerPort, $wgDBname;
+               global $wgUDPProfilerHost, $wgUDPProfilerPort, $wgDBname, 
$wgAggregateStatsID;
                static $socket;
+
+               $id = $wgAggregateStatsID !== false ? $wgAggregateStatsID : 
$wgDBname;
+
                if ( !$socket ) {
                        $socket = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );
-                       $statline = "stats/{$wgDBname} - 1 1 1 1 1 -total\n";
+                       $statline = "stats/{$id} - {$count} 1 1 1 1 -total\n";
                        socket_sendto(
                                $socket,
                                $statline,
@@ -2340,7 +2345,7 @@
                                $wgUDPProfilerPort
                        );
                }
-               $statline = "stats/{$wgDBname} - 1 1 1 1 1 {$key}\n";
+               $statline = "stats/{$id} - {$count} 1 1 1 1 {$key}\n";
                wfSuppressWarnings();
                socket_sendto(
                        $socket,
@@ -2354,8 +2359,8 @@
        } elseif( $wgStatsMethod == 'cache' ) {
                global $wgMemc;
                $key = wfMemcKey( 'stats', $key );
-               if ( is_null( $wgMemc->incr( $key ) ) ) {
-                       $wgMemc->add( $key, 1 );
+               if ( is_null( $wgMemc->incr( $key, $count ) ) ) {
+                       $wgMemc->add( $key, $count );
                }
        } else {
                // Disabled


Property changes on: branches/wmf/1.17wmf1/includes/GlobalFunctions.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/GlobalFunctions.php:51646
/branches/new-installer/phase3/includes/GlobalFunctions.php:43664-66004
/branches/resourceloader/phase3/includes/GlobalFunctions.php:71750
/branches/sqlite/includes/GlobalFunctions.php:58211-58321
/branches/wmf/1.16wmf4/includes/GlobalFunctions.php:67177,69199,76243,77266
/branches/wmf-deployment/includes/GlobalFunctions.php:53381,60970
/trunk/phase3/includes/GlobalFunctions.php:77988,78011-78012,78014-78016,78018,78043,78046,78071,78081,78083,78099,78117,78161,78170,78172,78199,78231,78248,78259,78300,78393,78450,78506-78507,78510-78511,78531-78532,78536,78539,78544,78565,78574,78660,78679,78774,78808,78823,78886-78887,78926,78943,78946,78964,79013,79018-79019,79034,79056,79066,79072,79086-79087,79091,79115,79122,79191,79213-79214,79253,79283,79537,79678,79684,79738,79741,79745,79750,79767-79768,82004,82025,82048,82070,82073,82081,82085,82088,82090-82091,82096,82100-82101,82114,82128-82131,82146
   + /branches/REL1_15/phase3/includes/GlobalFunctions.php:51646
/branches/new-installer/phase3/includes/GlobalFunctions.php:43664-66004
/branches/resourceloader/phase3/includes/GlobalFunctions.php:71750
/branches/sqlite/includes/GlobalFunctions.php:58211-58321
/branches/wmf/1.16wmf4/includes/GlobalFunctions.php:67177,69199,76243,77266
/branches/wmf-deployment/includes/GlobalFunctions.php:53381,60970
/trunk/phase3/includes/GlobalFunctions.php:77988,78011-78012,78014-78016,78018,78043,78046,78071,78081,78083,78099,78117,78161,78170,78172,78199,78231,78248,78259,78300,78393,78450,78506-78507,78510-78511,78531-78532,78536,78539,78544,78565,78574,78660,78679,78774,78808,78823,78886-78887,78926,78943,78946,78964,79013,79018-79019,79034,79056,79066,79072,79086-79087,79091,79115,79122,79191,79213-79214,79253,79283,79537,79678,79684,79738,79741,79745,79750,79767-79768,82004,82025,82048,82070,82073,82081,82085,82088,82090-82091,82096,82100-82101,82114,82128-82131,82146,83617

Modified: branches/wmf/1.17wmf1/includes/job/JobQueue.php
===================================================================
--- branches/wmf/1.17wmf1/includes/job/JobQueue.php     2011-03-10 01:58:25 UTC 
(rev 83627)
+++ branches/wmf/1.17wmf1/includes/job/JobQueue.php     2011-03-10 02:18:55 UTC 
(rev 83628)
@@ -69,6 +69,7 @@
                        return false;
                }
 
+               wfIncrStats( 'job-pop' );
                $namespace = $row->job_namespace;
                $dbkey = $row->job_title;
                $title = Title::makeTitleSafe( $namespace, $dbkey );
@@ -158,6 +159,7 @@
 
                // If execution got to here, there's a row in $row that has 
been deleted from the database
                // by this thread. Hence the concurrent pop was successful.
+               wfIncrStats( 'job-pop' );
                $namespace = $row->job_namespace;
                $dbkey = $row->job_title;
                $title = Title::makeTitleSafe( $namespace, $dbkey );
@@ -233,6 +235,7 @@
                        }
                }
                if ( $rows ) {
+                       wfIncrStats( 'job-insert', count( $rows ) );
                        $dbw->begin();
                        $dbw->insert( 'job', $rows, __METHOD__, 'IGNORE' );
                        $dbw->commit();
@@ -269,6 +272,7 @@
                                return;
                        }
                }
+               wfIncrStats( 'job-insert' );
                return $dbw->insert( 'job', $fields, __METHOD__ );
        }
 


Property changes on: branches/wmf/1.17wmf1/includes/job/JobQueue.php
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/REL1_15/phase3/includes/job/JobQueue.php:51646
/branches/new-installer/phase3/includes/job/JobQueue.php:43664-66004
/branches/sqlite/includes/job/JobQueue.php:58211-58321
/branches/wmf/1.16wmf4/includes/job/JobQueue.php:67177,69199,76243,77266
/branches/wmf-deployment/includes/job/JobQueue.php:53381,60970
/trunk/phase3/includes/job/JobQueue.php:83590,83617


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to