Aaron Schulz has uploaded a new change for review.

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

Change subject: Avoid negative JobRunner time stats
......................................................................

Avoid negative JobRunner time stats

This can happen in sub-second cases with skew. It makes
graphana tend to see -1 as the min for some time values.

Change-Id: I4e39d8ac29f515fd76548f1a7b64d71a03064407
---
M includes/jobqueue/JobRunner.php
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/05/259605/1

diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php
index b121dfe..5666415 100644
--- a/includes/jobqueue/JobRunner.php
+++ b/includes/jobqueue/JobRunner.php
@@ -201,14 +201,14 @@
                                // Record how long jobs wait before getting 
popped
                                $readyTs = $job->getReadyTimestamp();
                                if ( $readyTs ) {
-                                       $pickupDelay = $popTime - $readyTs;
+                                       $pickupDelay = max( 0, $popTime - 
$readyTs );
                                        $stats->timing( 
'jobqueue.pickup_delay.all', 1000 * $pickupDelay );
                                        $stats->timing( 
"jobqueue.pickup_delay.$jType", 1000 * $pickupDelay );
                                }
                                // Record root job age for jobs being run
                                $root = $job->getRootJobParams();
                                if ( $root['rootJobTimestamp'] ) {
-                                       $age = $popTime - wfTimestamp( TS_UNIX, 
$root['rootJobTimestamp'] );
+                                       $age = max( 0, $popTime - wfTimestamp( 
TS_UNIX, $root['rootJobTimestamp'] ) );
                                        $stats->timing( 
"jobqueue.pickup_root_age.$jType", 1000 * $age );
                                }
                                // Track the execution time for jobs

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e39d8ac29f515fd76548f1a7b64d71a03064407
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to