objectcache: change "miss" to "renew" in metric name for preemptive refreshes
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 20 Jun 2018 11:43:10 +0000 (12:43 +0100)
committerKrinkle <krinklemail@gmail.com>
Wed, 20 Jun 2018 15:23:35 +0000 (15:23 +0000)
This will usually let one distinguish asynchronous preemptive cache refreshes
from synchronous value recomputations due to actual cache misses.

Change-Id: I3424a89cc96a12fe283460eeaf722ee0cf299534

includes/libs/objectcache/WANObjectCache.php

index 927a1e3..0913322 100644 (file)
@@ -1223,7 +1223,8 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
                                }
                                // Use the busy fallback value if nothing else
                                if ( $busyValue !== null ) {
-                                       $this->stats->increment( "wanobjectcache.$kClass.miss.busy" );
+                                       $miss = is_infinite( $minTime ) ? 'renew' : 'miss';
+                                       $this->stats->increment( "wanobjectcache.$kClass.$miss.busy" );
 
                                        return is_callable( $busyValue ) ? $busyValue() : $busyValue;
                                }
@@ -1268,7 +1269,8 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
                        $this->cache->changeTTL( self::MUTEX_KEY_PREFIX . $key, (int)$preCallbackTime - 60 );
                }
 
-               $this->stats->increment( "wanobjectcache.$kClass.miss.compute" );
+               $miss = is_infinite( $minTime ) ? 'renew' : 'miss';
+               $this->stats->increment( "wanobjectcache.$kClass.$miss.compute" );
 
                return $value;
        }