From 55adc4422d92454229b4e3e26bd379657e6cebc5 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 20 Jul 2018 16:49:49 +1000 Subject: [PATCH] Send API timing to statsd for all requests, not just writes The rate will be about 8k req/s, whereas currently graphite1001 receives about 350k metric updates per second, so we would expect this to increase statsd load by about 2%. This would have been very helpful in diagnosing API cluster overload incidents such as the one on July 11. Change-Id: I0a248e1bcec05915d98ec735f4cfb9800e64412d --- includes/api/ApiMain.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index b398ecd04d..84708e7147 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -535,11 +535,9 @@ class ApiMain extends ApiBase { $this->executeAction(); $runTime = microtime( true ) - $t; $this->logRequest( $runTime ); - if ( $this->mModule->isWriteMode() && $this->getRequest()->wasPosted() ) { - MediaWikiServices::getInstance()->getStatsdDataFactory()->timing( - 'api.' . $this->mModule->getModuleName() . '.executeTiming', 1000 * $runTime - ); - } + MediaWikiServices::getInstance()->getStatsdDataFactory()->timing( + 'api.' . $this->mModule->getModuleName() . '.executeTiming', 1000 * $runTime + ); } catch ( Exception $e ) { $this->handleException( $e ); $this->logRequest( microtime( true ) - $t, $e ); -- 2.20.1