Include transaction details log entry for trx write time violations
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 8 May 2015 19:08:15 +0000 (12:08 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 8 May 2015 19:17:49 +0000 (19:17 +0000)
* This makes it possible to see what is being done by matching
  the trx IDs of the (normally) adjacent log entries

Change-Id: I515de99acfe159856930d8e259c00eb744f43213

includes/profiler/TransactionProfiler.php

index 3f4d58b..46d6119 100644 (file)
@@ -254,10 +254,14 @@ class TransactionProfiler implements LoggerAwareInterface {
                        $this->logger->info( "Detected no transaction for '$name' - out of sync." );
                        return;
                }
+
+               $slow = false;
+
                // Warn if too much time was spend writing...
                if ( $writeTime > $this->expect['writeQueryTime'] ) {
                        $this->reportExpectationViolated( 'writeQueryTime',
                                "[transaction $id writes to {$server} ({$db})]" );
+                       $slow = true;
                }
                // Fill in the last non-query period...
                $lastQuery = end( $this->dbTrxMethodTimes[$name] );
@@ -269,7 +273,6 @@ class TransactionProfiler implements LoggerAwareInterface {
                        }
                }
                // Check for any slow queries or non-query periods...
-               $slow = false;
                foreach ( $this->dbTrxMethodTimes[$name] as $info ) {
                        $elapsed = ( $info[2] - $info[1] );
                        if ( $elapsed >= $this->dbLockThreshold ) {