jenkins-bot has submitted this change and it was merged. Change subject: Use a parameterized log for sub-optimal transaction logging ......................................................................
Use a parameterized log for sub-optimal transaction logging In logstash these messages can't be grouped in any way, because they are all slightly different. By using a parameterized log message these can be grouped to give a better overview about the size of a problem. Change-Id: Icfa957bd1775b49bccd6e9920586c94eb4597f9b --- M includes/libs/rdbms/TransactionProfiler.php 1 file changed, 6 insertions(+), 4 deletions(-) Approvals: Aaron Schulz: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/libs/rdbms/TransactionProfiler.php b/includes/libs/rdbms/TransactionProfiler.php index 4d2b28f..12f6df5 100644 --- a/includes/libs/rdbms/TransactionProfiler.php +++ b/includes/libs/rdbms/TransactionProfiler.php @@ -295,13 +295,15 @@ } } if ( $slow ) { - $dbs = implode( ', ', array_keys( $this->dbTrxHoldingLocks[$name]['conns'] ) ); - $msg = "Sub-optimal transaction on DB(s) [{$dbs}]:\n"; + $trace = ''; foreach ( $this->dbTrxMethodTimes[$name] as $i => $info ) { list( $query, $sTime, $end ) = $info; - $msg .= sprintf( "%d\t%.6f\t%s\n", $i, ( $end - $sTime ), $query ); + $trace .= sprintf( "%d\t%.6f\t%s\n", $i, ( $end - $sTime ), $query ); } - $this->logger->info( $msg ); + $this->logger->info( "Sub-optimal transaction on DB(s) [{dbs}]: \n{trace}", [ + 'dbs' => implode( ', ', array_keys( $this->dbTrxHoldingLocks[$name]['conns'] ) ), + 'trace' => $trace + ] ); } unset( $this->dbTrxHoldingLocks[$name] ); unset( $this->dbTrxMethodTimes[$name] ); -- To view, visit https://gerrit.wikimedia.org/r/314333 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icfa957bd1775b49bccd6e9920586c94eb4597f9b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org> Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits