Anja Jentzsch has uploaded a new change for review.

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


Change subject: (bug 45984) Logging for change notification lag.
......................................................................

(bug 45984) Logging for change notification lag.

This adds debug output to dispatchChanges.php and ChangeNotificationJob classes,
to allow monitoring and analysis of lagging change notifications.

Change-Id: I56742c90cfe32737d326b4021b5177387e237206
---
M lib/includes/ChangeNotificationJob.php
M lib/maintenance/dispatchChanges.php
2 files changed, 25 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/59/53359/1

diff --git a/lib/includes/ChangeNotificationJob.php 
b/lib/includes/ChangeNotificationJob.php
index 11d109f..80e1b99 100644
--- a/lib/includes/ChangeNotificationJob.php
+++ b/lib/includes/ChangeNotificationJob.php
@@ -131,6 +131,18 @@
                //TODO: allow mock handler for testing
                ChangeHandler::singleton()->handleChanges( $changes );
 
+               if ( $changes ) {
+                       /* @var Change $last */
+                       $n = count( $changes );
+                       $last = end( $changes );
+
+                       wfDebugLog( __CLASS__, __METHOD__ . ": processed $n 
notifications, "
+                                               . "up to " . $last->getId() . 
", timestamp " . $last->getTime() . "; "
+                                               . "Lag is " . $last->getAge() . 
" seconds." );
+               } else {
+                       wfDebugLog( __CLASS__, __METHOD__ . ": processed no 
notifications." );
+               }
+
                return true;
        }
 
diff --git a/lib/maintenance/dispatchChanges.php 
b/lib/maintenance/dispatchChanges.php
index d8a2e2c..bc9690a 100644
--- a/lib/maintenance/dispatchChanges.php
+++ b/lib/maintenance/dispatchChanges.php
@@ -257,7 +257,19 @@
 
                $n = count( $changes );
 
-               $this->log( "Posted $n changes to $wikiDB" );
+               if ( $n === 0 ) {
+                       $this->log( "Posted no changes to $wikiDB (nothing to 
do). "
+                                               . "Next ID is $continueAfter." 
);
+               } else {
+                       /* @var Change $last */
+                       $last = end( $changes );
+
+                       $this->log( "Posted $n changes to $wikiDB, "
+                               . "up to ID " . $last->getId() . ", timestamp " 
. $last->getTime() . ". "
+                               . "Lag is " . $last->getAge() . " seconds. "
+                               . "Next ID is $continueAfter." );
+               }
+
                return $n;
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I56742c90cfe32737d326b4021b5177387e237206
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: mw1.21-wmf11
Gerrit-Owner: Anja Jentzsch <anja.jentz...@wikimedia.de>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to