Merge "Profile all external HTTP requests from MW"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 4 Mar 2015 05:39:36 +0000 (05:39 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 4 Mar 2015 05:39:36 +0000 (05:39 +0000)
includes/User.php
includes/UserRightsProxy.php
includes/db/Database.php
includes/db/LoadBalancer.php

index 03ac4fd..a4f6b77 100644 (file)
@@ -3375,7 +3375,9 @@ class User implements IDBAccessObject {
         * @param WebRequest|null $request WebRequest object to use; $wgRequest will be used if null
         *        is passed.
         */
-       protected function setCookie( $name, $value, $exp = 0, $secure = null, $params = array(), $request = null ) {
+       protected function setCookie(
+               $name, $value, $exp = 0, $secure = null, $params = array(), $request = null
+       ) {
                if ( $request === null ) {
                        $request = $this->getRequest();
                }
index 3be5847..1b9e4b6 100644 (file)
@@ -114,7 +114,8 @@ class UserRightsProxy {
         */
        private static function newFromLookup( $database, $field, $value, $ignoreInvalidDB = false ) {
                global $wgSharedDB, $wgSharedTables;
-               // If the user table is shared, perform the user query on it, but don't pass it to the UserRightsProxy,
+               // If the user table is shared, perform the user query on it,
+               // but don't pass it to the UserRightsProxy,
                // as user rights are normally not shared.
                if ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
                        $userdb = self::getDB( $wgSharedDB, $ignoreInvalidDB );
index 1a7a97d..b3c81f9 100644 (file)
@@ -817,10 +817,6 @@ abstract class DatabaseBase implements IDatabase {
                if ( $user ) {
                        $this->open( $server, $user, $password, $dbName );
                }
-
-               $isMaster = !is_null( $this->getLBInfo( 'master' ) );
-               $trxProf = $this->getTransactionProfiler();
-               $trxProf->recordConnection( $this->mServer, $this->mDBname, $isMaster );
        }
 
        /**
index 917d703..dd95844 100644 (file)
@@ -756,6 +756,10 @@ class LoadBalancer {
                        $db = $e->db;
                }
 
+               $isMaster = !empty( $server['master'] );
+               $trxProf = Profiler::instance()->getTransactionProfiler();
+               $trxProf->recordConnection( $server['host'], $server['dbname'], $isMaster );
+
                $db->setLBInfo( $server );
                if ( isset( $server['fakeSlaveLag'] ) ) {
                        $db->setFakeSlaveLag( $server['fakeSlaveLag'] );