From: Tim Starling Date: Fri, 20 Jul 2018 06:49:49 +0000 (+1000) Subject: Send API timing to statsd for all requests, not just writes X-Git-Tag: 1.34.0-rc.0~4690^2 X-Git-Url: http://git.cyclocoop.org/data/%24self?a=commitdiff_plain;h=55adc4422d92454229b4e3e26bd379657e6cebc5;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 );