Job queue: prefix metric keys with 'jobqueue'; segment with '.'
authorOri Livneh <ori@wikimedia.org>
Fri, 12 Jun 2015 17:41:52 +0000 (10:41 -0700)
committerOri.livneh <ori@wikimedia.org>
Fri, 12 Jun 2015 17:43:50 +0000 (17:43 +0000)
Currently names are segmented with a dash (for legacy reasons), which
makes them clutter the top-level MediaWiki.* metric namespace.

Change-Id: I785819723808368fbf9c3f5ea167f50f40733a3a

includes/jobqueue/JobQueue.php

index 013cc61..1cf1b4b 100644 (file)
@@ -683,8 +683,12 @@ abstract class JobQueue {
         * @since 1.22
         */
        public static function incrStats( $key, $type, $delta = 1 ) {
-               wfIncrStats( $key, $delta );
-               wfIncrStats( "{$key}-{$type}", $delta );
+               static $stats;
+               if ( !$stats ) {
+                       $stats = RequestContext::getMain()->getStats();
+               }
+               $stats->updateCount( "jobqueue.{$key}", $delta );
+               $stats->updateCount( "jobqueue.{$key}.{$type}", $delta );
        }
 
        /**