jenkins-bot has submitted this change and it was merged.
Change subject: Add stats recording to dispatchChanges.php
......................................................................
Add stats recording to dispatchChanges.php
This will allow us to.
- How many script runs are happening.
- How many changes are being dispatched.
- How long the script is running each time.
- How many passes are being completed.
- The number of times there are no changes to go.
- The number of exceptions encountered.
Change-Id: I641bf5557e61fc85e7858e1b962c04fe921f022d
---
M repo/maintenance/dispatchChanges.php
1 file changed, 15 insertions(+), 3 deletions(-)
Approvals:
Hoo man: Looks good to me, approved
jenkins-bot: Verified
diff --git a/repo/maintenance/dispatchChanges.php
b/repo/maintenance/dispatchChanges.php
index eff968e..bfe2442 100644
--- a/repo/maintenance/dispatchChanges.php
+++ b/repo/maintenance/dispatchChanges.php
@@ -5,6 +5,7 @@
use Exception;
use Maintenance;
use MWException;
+use RequestContext;
use Wikibase\Lib\Reporting\ObservableMessageReporter;
use Wikibase\Lib\Reporting\ReportingExceptionHandler;
use Wikibase\Lib\Store\ChangeLookup;
@@ -176,12 +177,15 @@
$dispatcher->getDispatchCoordinator()->initState( $clientWikis
);
+ $stats = RequestContext::getMain()->getStats();
+ $stats->increment( 'wikibase.repo.dispatchChanges.start' );
+
$passes = $maxPasses === PHP_INT_MAX ? "unlimited" : $maxPasses;
$time = $maxTime === PHP_INT_MAX ? "unlimited" : $maxTime;
$this->log( "Starting loop for $passes passes or $time seconds"
);
- $startTime = time();
+ $startTime = microtime( true );
$t = 0;
// Run passes in a loop, sleeping when idle.
@@ -194,6 +198,7 @@
break;
}
+ $runStartTime = microtime( true );
$c++;
try {
@@ -201,8 +206,10 @@
$wikiState = $dispatcher->selectClient();
if ( $wikiState ) {
- $dispatcher->dispatchTo( $wikiState );
+ $dispatchedChanges =
$dispatcher->dispatchTo( $wikiState );
+ $stats->updateCount(
'wikibase.repo.dispatchChanges.changes', $dispatchedChanges );
} else {
+ $stats->increment(
'wikibase.repo.dispatchChanges.noclient' );
// Try again later, unless we have
already reached the limit.
if ( $c < $maxPasses ) {
$this->trace( "Idle: No client
wiki found in need of dispatching. "
@@ -214,6 +221,7 @@
}
}
} catch ( Exception $ex ) {
+ $stats->increment(
'wikibase.repo.dispatchChanges.exception' );
if ( $c < $maxPasses ) {
$this->log( "ERROR: $ex; sleeping for
{$delay} seconds" );
sleep( $delay );
@@ -222,9 +230,13 @@
}
}
- $t = ( time() - $startTime );
+ $t = ( microtime( true ) - $startTime );
+ $stats->timing(
'wikibase.repo.dispatchChanges.pass-time', ( microtime( true ) - $runStartTime
) * 1000 );
}
+ $stats->timing( 'wikibase.repo.dispatchChanges.execute-time',
$t * 1000 );
+ $stats->updateCount( 'wikibase.repo.dispatchChanges.passes', $c
);
+
$this->log( "Done, exiting after $c passes and $t seconds." );
}
--
To view, visit https://gerrit.wikimedia.org/r/268591
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I641bf5557e61fc85e7858e1b962c04fe921f022d
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: JanZerebecki <[email protected]>
Gerrit-Reviewer: Lydia Pintscher <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits