hierarchicalize(!) stat names
authorOri Livneh <ori@wikimedia.org>
Wed, 3 Jun 2015 22:38:02 +0000 (15:38 -0700)
committerOri Livneh <ori@wikimedia.org>
Wed, 3 Jun 2015 23:27:13 +0000 (16:27 -0700)
Graphite expects name components to be dot-separated, so our habit of using
dashes doesn't really make sense. Change metric names to be more compatible
with Graphite, except the job queue's, since that will require a gdash
dashboard definition migration.

Change-Id: I77d0ff7606a8fc88434e4352d23415a9a8f4725a

includes/db/LoadMonitor.php
includes/diff/DifferenceEngine.php
includes/filerepo/file/LocalFile.php
includes/page/WikiPage.php
includes/parser/ParserCache.php
includes/resourceloader/ResourceLoader.php

index 3d853cb..8c4d0ed 100644 (file)
@@ -109,9 +109,9 @@ class LoadMonitorMySQL implements LoadMonitor {
 
                                return $times;
                        }
-                       wfIncrStats( 'lag_cache_miss_expired' );
+                       wfIncrStats( 'lag_cache.miss.expired' );
                } else {
-                       wfIncrStats( 'lag_cache_miss_absent' );
+                       wfIncrStats( 'lag_cache.miss.absent' );
                }
 
                # Cache key missing or expired
index 2c63dfb..07a0522 100644 (file)
@@ -714,7 +714,7 @@ class DifferenceEngine extends ContextSource {
                        if ( !$this->mRefreshCache ) {
                                $difftext = $wgMemc->get( $key );
                                if ( $difftext ) {
-                                       wfIncrStats( 'diff_cache_hit' );
+                                       wfIncrStats( 'diff_cache.hit' );
                                        $difftext = $this->localiseLineNumbers( $difftext );
                                        $difftext .= "\n<!-- diff cache key $key -->\n";
 
@@ -734,12 +734,12 @@ class DifferenceEngine extends ContextSource {
 
                // Save to cache for 7 days
                if ( !Hooks::run( 'AbortDiffCache', array( &$this ) ) ) {
-                       wfIncrStats( 'diff_uncacheable' );
+                       wfIncrStats( 'diff_cache.uncacheable' );
                } elseif ( $key !== false && $difftext !== false ) {
-                       wfIncrStats( 'diff_cache_miss' );
+                       wfIncrStats( 'diff_cache.miss' );
                        $wgMemc->set( $key, $difftext, 7 * 86400 );
                } else {
-                       wfIncrStats( 'diff_uncacheable' );
+                       wfIncrStats( 'diff_cache.uncacheable' );
                }
                // Replace line numbers with the text in the user's language
                if ( $difftext !== false ) {
index b763c8d..6abe00c 100644 (file)
@@ -269,9 +269,9 @@ class LocalFile extends File {
                }
 
                if ( $this->dataLoaded ) {
-                       wfIncrStats( 'image_cache_hit' );
+                       wfIncrStats( 'image_cache.hit' );
                } else {
-                       wfIncrStats( 'image_cache_miss' );
+                       wfIncrStats( 'image_cache.miss' );
                }
 
                return $this->dataLoaded;
index 1fd22cf..59e8731 100644 (file)
@@ -1111,7 +1111,7 @@ class WikiPage implements Page, IDBAccessObject {
                $useParserCache = $this->isParserCacheUsed( $parserOptions, $oldid );
                wfDebug( __METHOD__ . ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
                if ( $parserOptions->getStubThreshold() ) {
-                       wfIncrStats( 'pcache_miss_stub' );
+                       wfIncrStats( 'pcache.miss.stub' );
                }
 
                if ( $useParserCache ) {
index 131b7b5..98d3f7f 100644 (file)
@@ -143,13 +143,13 @@ class ParserCache {
                $optionsKey = $this->mMemc->get( $this->getOptionsKey( $article ) );
                if ( $optionsKey != false ) {
                        if ( !$useOutdated && $optionsKey->expired( $article->getTouched() ) ) {
-                               wfIncrStats( "pcache_miss_expired" );
+                               wfIncrStats( "pcache.miss.expired" );
                                $cacheTime = $optionsKey->getCacheTime();
                                wfDebug( "Parser options key expired, touched " . $article->getTouched()
                                        . ", epoch $wgCacheEpoch, cached $cacheTime\n" );
                                return false;
                        } elseif ( $optionsKey->isDifferentRevision( $article->getLatest() ) ) {
-                               wfIncrStats( "pcache_miss_revid" );
+                               wfIncrStats( "pcache.miss.revid" );
                                $revId = $article->getLatest();
                                $cachedRevId = $optionsKey->getCacheRevisionId();
                                wfDebug( "ParserOutput key is for an old revision, latest $revId, cached $cachedRevId\n" );
@@ -195,14 +195,14 @@ class ParserCache {
 
                $parserOutputKey = $this->getKey( $article, $popts, $useOutdated );
                if ( $parserOutputKey === false ) {
-                       wfIncrStats( 'pcache_miss_absent' );
+                       wfIncrStats( 'pcache.miss.absent' );
                        return false;
                }
 
                $value = $this->mMemc->get( $parserOutputKey );
                if ( !$value ) {
                        wfDebug( "ParserOutput cache miss.\n" );
-                       wfIncrStats( "pcache_miss_absent" );
+                       wfIncrStats( "pcache.miss.absent" );
                        return false;
                }
 
@@ -214,19 +214,19 @@ class ParserCache {
                $value->setEditSectionTokens( $popts->getEditSection() );
 
                if ( !$useOutdated && $value->expired( $touched ) ) {
-                       wfIncrStats( "pcache_miss_expired" );
+                       wfIncrStats( "pcache.miss.expired" );
                        $cacheTime = $value->getCacheTime();
                        wfDebug( "ParserOutput key expired, touched $touched, "
                                . "epoch $wgCacheEpoch, cached $cacheTime\n" );
                        $value = false;
                } elseif ( $value->isDifferentRevision( $article->getLatest() ) ) {
-                       wfIncrStats( "pcache_miss_revid" );
+                       wfIncrStats( "pcache.miss.revid" );
                        $revId = $article->getLatest();
                        $cachedRevId = $value->getCacheRevisionId();
                        wfDebug( "ParserOutput key is for an old revision, latest $revId, cached $cachedRevId\n" );
                        $value = false;
                } else {
-                       wfIncrStats( "pcache_hit" );
+                       wfIncrStats( "pcache.hit" );
                }
 
                return $value;
index b4b5a2e..9970a89 100644 (file)
@@ -200,12 +200,12 @@ class ResourceLoader {
                        $cache = wfGetCache( CACHE_ANYTHING );
                        $cacheEntry = $cache->get( $key );
                        if ( is_string( $cacheEntry ) ) {
-                               wfIncrStats( "rl-$filter-cache-hits" );
+                               wfIncrStats( "resourceloader_cache.$filter.hit" );
                                return $cacheEntry;
                        }
                        $result = '';
                        try {
-                               wfIncrStats( "rl-$filter-cache-misses" );
+                               wfIncrStats( "resourceloader_cache.$filter.miss" );
                                $result = $this->applyFilter( $filter, $data );
                                if ( $options['cacheReport'] ) {
                                        $result .= "\n/* cache key: $key */";