Ori.livneh has submitted this change and it was merged.
Change subject: jobqueue: use more sensible metric key names
......................................................................
jobqueue: use more sensible metric key names
* Since JobQueue metrics are qualified with 'jobqueue.', don't add a 'job-'
prefix to each metric.
* Separate the key from the job type with a dot rather than a dash.
* To avoid having a Graphite node that is both a "directory" and a metric, use
'.all' as a suffix for aggregates.
Change-Id: I2ac604d3c042dbfb0b3a27759800f435ec22041e
(cherry picked from commit 427bdb6dbd78e469bdd15f33f9c742b0cc460e61)
---
M includes/jobqueue/JobQueue.php
M includes/jobqueue/JobQueueDB.php
M includes/jobqueue/JobQueueRedis.php
M includes/jobqueue/JobRunner.php
4 files changed, 16 insertions(+), 16 deletions(-)
Approvals:
Ori.livneh: Verified; Looks good to me, approved
diff --git a/includes/jobqueue/JobQueue.php b/includes/jobqueue/JobQueue.php
index 1cf1b4b..b4a2184 100644
--- a/includes/jobqueue/JobQueue.php
+++ b/includes/jobqueue/JobQueue.php
@@ -365,7 +365,7 @@
// Flag this job as an old duplicate based on its "root" job...
try {
if ( $job && $this->isRootJobOldDuplicate( $job ) ) {
- JobQueue::incrStats( 'job-pop-duplicate',
$this->type );
+ JobQueue::incrStats( 'dupe_pops', $this->type );
$job = DuplicateJob::newFromJob( $job ); //
convert to a no-op
}
} catch ( Exception $e ) {
@@ -687,7 +687,7 @@
if ( !$stats ) {
$stats = RequestContext::getMain()->getStats();
}
- $stats->updateCount( "jobqueue.{$key}", $delta );
+ $stats->updateCount( "jobqueue.{$key}.all", $delta );
$stats->updateCount( "jobqueue.{$key}.{$type}", $delta );
}
diff --git a/includes/jobqueue/JobQueueDB.php b/includes/jobqueue/JobQueueDB.php
index 3dc36bd..d1e4a13 100644
--- a/includes/jobqueue/JobQueueDB.php
+++ b/includes/jobqueue/JobQueueDB.php
@@ -245,10 +245,8 @@
foreach ( array_chunk( $rows, 50 ) as $rowBatch ) {
$dbw->insert( 'job', $rowBatch, $method );
}
- JobQueue::incrStats( 'job-insert', $this->type, count(
$rows ) );
- JobQueue::incrStats(
- 'job-insert-duplicate',
- $this->type,
+ JobQueue::incrStats( 'inserts', $this->type, count(
$rows ) );
+ JobQueue::incrStats( 'dupe_inserts', $this->type,
count( $rowSet ) + count( $rowList ) - count(
$rows )
);
} catch ( DBError $e ) {
@@ -293,7 +291,7 @@
if ( !$row ) {
break; // nothing to do
}
- JobQueue::incrStats( 'job-pop', $this->type );
+ JobQueue::incrStats( 'pops', $this->type );
// Get the job object from the row...
$title = Title::makeTitle( $row->job_namespace,
$row->job_title );
$job = Job::factory( $row->job_cmd, $title,
@@ -479,7 +477,7 @@
$dbw->delete( 'job',
array( 'job_cmd' => $this->type, 'job_id' =>
$job->metadata['id'] ), __METHOD__ );
- JobQueue::incrStats( 'job-ack', $this->type );
+ JobQueue::incrStats( 'acks', $this->type );
} catch ( DBError $e ) {
$this->throwDBException( $e );
}
@@ -679,7 +677,7 @@
);
$affected = $dbw->affectedRows();
$count += $affected;
- JobQueue::incrStats( 'job-recycle',
$this->type, $affected );
+ JobQueue::incrStats( 'recycles',
$this->type, $affected );
$this->aggr->notifyQueueNonEmpty(
$this->wiki, $this->type );
}
}
@@ -706,7 +704,7 @@
$dbw->delete( 'job', array( 'job_id' => $ids ),
__METHOD__ );
$affected = $dbw->affectedRows();
$count += $affected;
- JobQueue::incrStats( 'job-abandon',
$this->type, $affected );
+ JobQueue::incrStats( 'abandons', $this->type,
$affected );
}
$dbw->unlock( "jobqueue-recycle-{$this->type}",
__METHOD__ );
diff --git a/includes/jobqueue/JobQueueRedis.php
b/includes/jobqueue/JobQueueRedis.php
index 0f7ab19..e021d99 100644
--- a/includes/jobqueue/JobQueueRedis.php
+++ b/includes/jobqueue/JobQueueRedis.php
@@ -223,8 +223,8 @@
throw new RedisException( "Could not insert
{$failed} {$this->type} job(s)." );
}
- JobQueue::incrStats( 'job-insert', $this->type, count(
$items ) );
- JobQueue::incrStats( 'job-insert-duplicate',
$this->type,
+ JobQueue::incrStats( 'inserts', $this->type, count(
$items ) );
+ JobQueue::incrStats( 'dupe_inserts', $this->type,
count( $items ) - $failed - $pushed );
} catch ( RedisException $e ) {
$this->throwRedisException( $conn, $e );
diff --git a/includes/jobqueue/JobRunner.php b/includes/jobqueue/JobRunner.php
index efc36cc..77c4238 100644
--- a/includes/jobqueue/JobRunner.php
+++ b/includes/jobqueue/JobRunner.php
@@ -126,7 +126,7 @@
}
$group = JobQueueGroup::singleton();
-
+
// Flush any pending DB writes for sanity
wfGetLBFactory()->commitAll();
@@ -199,10 +199,12 @@
$timeMsTotal += $timeMs;
$profiler->scopedProfileOut( $psection );
- if ( $job->getQueuedTimestamp() ) {
+ $queuedTs = $job->getQueuedTimestamp();
+ if ( $queuedTs ) {
// Record time to run for the job type
- $stats->timing( "job-pickuptime-$jType",
- $popTime -
$job->getQueuedTimestamp() );
+ $pickupDelay = $popTime - $queuedTs;
+ $stats->timing(
'jobqueue.pickup_delay.all', $queuedTs );
+ $stats->timing(
"jobqueue.pickup_delay.$jType", $queuedTs );
}
// Mark the job as done on success or when the
job cannot be retried
--
To view, visit https://gerrit.wikimedia.org/r/218412
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2ac604d3c042dbfb0b3a27759800f435ec22041e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.26wmf9
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits