Ori.livneh has uploaded a new change for review.

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

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(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/20/284120/1

diff --git a/includes/api/ApiStashEdit.php b/includes/api/ApiStashEdit.php
index 3c02c9c..4c9f0eb 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.timestamp_based' );
                        $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.template_changed' );
                                $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.file_changed' );
                                $logger->info( "Stale cache for key '$key'; 
file changed." );
                                return false;
                        }
                }
 
-               $stats->increment( 'editstash.cache-hits' );
+               $stats->increment( 
'editstash.cache_hits.survived_staleness_checks' );
                $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: newchange
Gerrit-Change-Id: I0cd61da9746e3ca3695e23200f698b8b1371798c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>

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

Reply via email to