From 951b3392bf7d2545ad4f90fefc3e3e2f1d0715e0 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 12 Jul 2019 11:24:51 -0700 Subject: [PATCH] objectcache: add regen_walltime metric to WANObjectCache::getWithSetCallback() Change-Id: I7918a6ed7a5d3d845c640aeeb78c88f1345f5157 --- includes/libs/objectcache/README.md | 8 ++++++++ includes/libs/objectcache/WANObjectCache.php | 1 + 2 files changed, 9 insertions(+) diff --git a/includes/libs/objectcache/README.md b/includes/libs/objectcache/README.md index 833c045ac5..42bf6360dd 100644 --- a/includes/libs/objectcache/README.md +++ b/includes/libs/objectcache/README.md @@ -35,6 +35,14 @@ in sending the value to the backend server. * Type: Measure (in milliseconds). * Variable `kClass`: The first part of your cache key. +#### `wanobjectcache.{kClass}.regen_walltime` + +Upon cache miss, this measures the time spent in `WANObjectCache::getWithSetCallback()` +from the start of the callback to right after the new value has been computed. + +* Type: Measure (in milliseconds). +* Variable `kClass`: The first part of your cache key. + #### `wanobjectcache.{kClass}.ck_touch.{result}` Call counter from `WANObjectCache::touchCheckKey()`. diff --git a/includes/libs/objectcache/WANObjectCache.php b/includes/libs/objectcache/WANObjectCache.php index 45caa783e1..07e4fadece 100644 --- a/includes/libs/objectcache/WANObjectCache.php +++ b/includes/libs/objectcache/WANObjectCache.php @@ -1423,6 +1423,7 @@ class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInt ) { // How long it took to generate the value $walltime = max( $postCallbackTime - $preCallbackTime, 0.0 ); + $this->stats->timing( "wanobjectcache.$kClass.regen_walltime", 1e3 * $walltime ); // If the key is write-holed then use the (volatile) interim key as an alternative if ( $isKeyTombstoned ) { $this->setInterimValue( $key, $value, $lockTSE, $version, $walltime ); -- 2.20.1