jenkins-bot has submitted this change and it was merged.

Change subject: Segment stash edit cache stats by basis for hit/miss
......................................................................


Segment stash edit cache stats by basis for hit/miss

Instead of just counting cache hits and misses, segment the counts by reason,
so we can differentiate (for example) timestamp-based cache hits from
staleness-check-survivor cache hits. I want this data so I can determine
whether increasing the cutoff for timestamp-based hits from 3 to 5 seconds has
a substantial enough impact to warrant the slightly weaker consistency.

Also changed 'cache-hit' to 'cache_hit'. MediaWiki normalizes the dash to an
underscore anyway, but the normalization is there for dynamically-constructed
key names (or name segments). In the case of hard-coded values, it is desirable
for the code to be as close as possible to the final form of the metric name,
to simplify metric lookup.

Change-Id: I0cd61da9746e3ca3695e23200f698b8b1371798c
---
M includes/api/ApiStashEdit.php
1 file changed, 6 insertions(+), 6 deletions(-)

Approvals:
  Ori.livneh: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/api/ApiStashEdit.php b/includes/api/ApiStashEdit.php
index 3c02c9c..cc8e390 100644
--- a/includes/api/ApiStashEdit.php
+++ b/includes/api/ApiStashEdit.php
@@ -272,18 +272,18 @@
                        }
 
                        $timeMs = 1000 * max( 0, microtime( true ) - $start );
-                       $stats->timing( 'editstash.lock-wait-time', $timeMs );
+                       $stats->timing( 'editstash.lock_wait_time', $timeMs );
                }
 
                if ( !is_object( $editInfo ) || !$editInfo->output ) {
-                       $stats->increment( 'editstash.cache-misses' );
+                       $stats->increment( 'editstash.cache_misses.no_stash' );
                        $logger->debug( "No cache value for key '$key'." );
                        return false;
                }
 
                $time = wfTimestamp( TS_UNIX, $editInfo->output->getTimestamp() 
);
                if ( ( time() - $time ) <= 3 ) {
-                       $stats->increment( 'editstash.cache-hits' );
+                       $stats->increment( 
'editstash.cache_hits.presumed_fresh' );
                        $logger->debug( "Timestamp-based cache hit for key 
'$key'." );
                        return $editInfo; // assume nothing changed
                }
@@ -312,7 +312,7 @@
                        }
 
                        if ( $changed || $res->numRows() != $templateUses ) {
-                               $stats->increment( 'editstash.cache-misses' );
+                               $stats->increment( 
'editstash.cache_misses.proven_stale' );
                                $logger->info( "Stale cache for key '$key'; 
template changed." );
                                return false;
                        }
@@ -336,13 +336,13 @@
                        }
 
                        if ( $changed || $res->numRows() != count( $files ) ) {
-                               $stats->increment( 'editstash.cache-misses' );
+                               $stats->increment( 
'editstash.cache_misses.proven_stale' );
                                $logger->info( "Stale cache for key '$key'; 
file changed." );
                                return false;
                        }
                }
 
-               $stats->increment( 'editstash.cache-hits' );
+               $stats->increment( 'editstash.cache_hits.proven_fresh' );
                $logger->debug( "Cache hit for key '$key'." );
 
                return $editInfo;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I0cd61da9746e3ca3695e23200f698b8b1371798c
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to