Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/286249

Change subject: Fix executeTiming statsd metrics
......................................................................

Fix executeTiming statsd metrics

Nothing was being sent out before.

Change-Id: I5d3c681337fc49bd3026781c1bcddf0f2d8e6b8a
---
M includes/api/ApiMain.php
1 file changed, 9 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/49/286249/1

diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index 07642c4..4fa197f 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -134,7 +134,9 @@
        private $mModuleMgr, $mResult, $mErrorFormatter, $mContinuationManager;
        private $mAction;
        private $mEnableWrite;
-       private $mInternalMode, $mSquidMaxage, $mModule;
+       private $mInternalMode, $mSquidMaxage;
+       /** @var ApiBase */
+       private $mModule;
 
        private $mCacheMode = 'private';
        private $mCacheControl = [];
@@ -397,13 +399,7 @@
                if ( $this->mInternalMode ) {
                        $this->executeAction();
                } else {
-                       $start = microtime( true );
                        $this->executeActionWithErrorHandling();
-                       if ( $this->isWriteMode() && 
$this->getRequest()->wasPosted() ) {
-                               $timeMs = 1000 * max( 0, microtime( true ) - 
$start );
-                               $this->getStats()->timing(
-                                       'api.' . $this->getModuleName() . 
'.executeTiming', $timeMs );
-                       }
                }
        }
 
@@ -433,8 +429,12 @@
                $isError = false;
                try {
                        $this->executeAction();
-                       $this->logRequest( microtime( true ) - $t );
-
+                       $runTime = microtime( true ) - $t;
+                       $this->logRequest( $runTime );
+                       if ( $this->mModule->isWriteMode() && 
$this->getRequest()->wasPosted() ) {
+                               $this->getStats()->timing(
+                                       'api.' . $this->getModuleName() . 
'.executeTiming', 1000 * $runTime );
+                       }
                } catch ( Exception $e ) {
                        $this->handleException( $e );
                        $this->logRequest( microtime( true ) - $t, $e );

-- 
To view, visit https://gerrit.wikimedia.org/r/286249
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d3c681337fc49bd3026781c1bcddf0f2d8e6b8a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to