From f696f47c97b05847659e6e0e70cd66769c35fc1f Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 11 Jun 2018 12:44:18 -0700 Subject: [PATCH] rdbms: avoid redundant SPI logging fields in ChronologyProtector log entries Also renamed the field to a better name. Change-Id: I8bd13a01415a7518b5d9f7dc393b32848efebbf6 --- includes/libs/rdbms/ChronologyProtector.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/includes/libs/rdbms/ChronologyProtector.php b/includes/libs/rdbms/ChronologyProtector.php index 72ca5901c2..b0dc10ebed 100644 --- a/includes/libs/rdbms/ChronologyProtector.php +++ b/includes/libs/rdbms/ChronologyProtector.php @@ -44,7 +44,7 @@ class ChronologyProtector implements LoggerAwareInterface { /** @var string Hash of client parameters */ protected $clientId; /** @var string[] Map of client information fields for logging */ - protected $clientInfo; + protected $clientLogInfo; /** @var int|null Expected minimum index of the last write to the position store */ protected $waitForPosIndex; /** @var int Max seconds to wait on positions to appear */ @@ -84,7 +84,11 @@ class ChronologyProtector implements LoggerAwareInterface { $this->key = $store->makeGlobalKey( __CLASS__, $this->clientId, 'v2' ); $this->waitForPosIndex = $posIndex; - $this->clientInfo = $client + [ 'clientId' => '' ]; + $this->clientLogInfo = [ + 'clientIP' => $client['ip'], + 'clientAgent' => $client['agent'], + 'clientId' => $client['clientId'] ?? null + ]; $this->logger = new NullLogger(); } @@ -313,7 +317,7 @@ class ChronologyProtector implements LoggerAwareInterface { [ 'cpPosIndex' => $this->waitForPosIndex, 'waitTimeMs' => $waitedMs - ] + $this->clientInfo + ] + $this->clientLogInfo ); } else { $this->logger->warning( @@ -322,7 +326,7 @@ class ChronologyProtector implements LoggerAwareInterface { 'cpPosIndex' => $this->waitForPosIndex, 'indexReached' => $indexReached, 'waitTimeMs' => $waitedMs - ] + $this->clientInfo + ] + $this->clientLogInfo ); } } else { -- 2.20.1