From 3bf391e842ef576928af5068999ed17473d5c4a1 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 10 Aug 2015 16:25:25 -0700 Subject: [PATCH] Added statsd metrics for ObjectCacheSessionHandler Change-Id: I86e967a027e2010f962831b55a9fceab02d8a19e --- includes/objectcache/ObjectCacheSessionHandler.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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; } -- 2.20.1