From: Aaron Schulz Date: Fri, 19 Apr 2019 21:10:27 +0000 (-0700) Subject: editstash: segregate stats by content type for more useful graphing X-Git-Tag: 1.34.0-rc.0~1917^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=9de4bc9df193f4885cbf9702dc2a9a1a498b0b73;p=lhc%2Fweb%2Fwiklou.git editstash: segregate stats by content type for more useful graphing Change-Id: Ice590a163ab7790993e44995220ca093f90c7c4f --- diff --git a/includes/Storage/PageEditStash.php b/includes/Storage/PageEditStash.php index cc3e4bc45d..46f957fded 100644 --- a/includes/Storage/PageEditStash.php +++ b/includes/Storage/PageEditStash.php @@ -221,7 +221,7 @@ class PageEditStash { $editInfo = $this->getAndWaitForStashValue( $key ); if ( !is_object( $editInfo ) || !$editInfo->output ) { - $this->stats->increment( 'editstash.cache_misses.no_stash' ); + $this->incrStatsByContent( 'cache_misses.no_stash', $content ); if ( $this->recentStashEntryCount( $user ) > 0 ) { $logger->info( "Empty cache for key '{key}' but not for user.", $context ); } else { @@ -237,28 +237,28 @@ class PageEditStash { $isCacheUsable = true; if ( $age <= self::PRESUME_FRESH_TTL_SEC ) { // Assume nothing changed in this time - $this->stats->increment( 'editstash.cache_hits.presumed_fresh' ); + $this->incrStatsByContent( 'cache_hits.presumed_fresh', $content ); $logger->debug( "Timestamp-based cache hit for key '{key}'.", $context ); } elseif ( $user->isAnon() ) { $lastEdit = $this->lastEditTime( $user ); $cacheTime = $editInfo->output->getCacheTime(); if ( $lastEdit < $cacheTime ) { // Logged-out user made no local upload/template edits in the meantime - $this->stats->increment( 'editstash.cache_hits.presumed_fresh' ); + $this->incrStatsByContent( 'cache_hits.presumed_fresh', $content ); $logger->debug( "Edit check based cache hit for key '{key}'.", $context ); } else { $isCacheUsable = false; - $this->stats->increment( 'editstash.cache_misses.proven_stale' ); + $this->incrStatsByContent( 'cache_misses.proven_stale', $content ); $logger->info( "Stale cache for key '{key}' due to outside edits.", $context ); } } else { if ( $editInfo->edits === $user->getEditCount() ) { // Logged-in user made no local upload/template edits in the meantime - $this->stats->increment( 'editstash.cache_hits.presumed_fresh' ); + $this->incrStatsByContent( 'cache_hits.presumed_fresh', $content ); $logger->debug( "Edit count based cache hit for key '{key}'.", $context ); } else { $isCacheUsable = false; - $this->stats->increment( 'editstash.cache_misses.proven_stale' ); + $this->incrStatsByContent( 'cache_misses.proven_stale', $content ); $logger->info( "Stale cache for key '{key}'due to outside edits.", $context ); } } @@ -285,6 +285,15 @@ class PageEditStash { return $editInfo; } + /** + * @param string $subkey + * @param Content $content + */ + private function incrStatsByContent( $subkey, Content $content ) { + $this->stats->increment( 'editstash.' . $subkey ); // overall for b/c + $this->stats->increment( 'editstash_by_model.' . $content->getModel() . '.' . $subkey ); + } + /** * @param string $key * @return bool|stdClass