From: Aaron Schulz Date: Mon, 10 Aug 2015 23:25:25 +0000 (-0700) Subject: Added statsd metrics for ObjectCacheSessionHandler X-Git-Tag: 1.31.0-rc.0~10436 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=3bf391e842ef576928af5068999ed17473d5c4a1;p=lhc%2Fweb%2Fwiklou.git Added statsd metrics for ObjectCacheSessionHandler Change-Id: I86e967a027e2010f962831b55a9fceab02d8a19e --- diff --git a/includes/objectcache/ObjectCacheSessionHandler.php b/includes/objectcache/ObjectCacheSessionHandler.php index 1f4beb9dec..6a9b9a87b5 100644 --- a/includes/objectcache/ObjectCacheSessionHandler.php +++ b/includes/objectcache/ObjectCacheSessionHandler.php @@ -108,7 +108,11 @@ class ObjectCacheSessionHandler { * @return mixed Session data */ static function read( $id ) { + $stime = microtime( true ); $data = self::getCache()->get( self::getKey( $id ) ); + $real = microtime( true ) - $stime; + + RequestContext::getMain()->getStats()->timing( "session.read", $real ); self::$hashCache = array( $id => self::getHash( $data ) ); @@ -129,7 +133,11 @@ class ObjectCacheSessionHandler { if ( !isset( self::$hashCache[$id] ) || self::getHash( $data ) !== self::$hashCache[$id] ) { + $stime = microtime( true ); self::getCache()->set( self::getKey( $id ), $data, $wgObjectCacheSessionExpiry ); + $real = microtime( true ) - $stime; + + RequestContext::getMain()->getStats()->timing( "session.write", $real ); } return true; @@ -142,7 +150,11 @@ class ObjectCacheSessionHandler { * @return bool Success */ static function destroy( $id ) { + $stime = microtime( true ); self::getCache()->delete( self::getKey( $id ) ); + $real = microtime( true ) - $stime; + + RequestContext::getMain()->getStats()->timing( "session.destroy", $real ); return true; }