From 4478384155e36a886538189186242fd6d5420a44 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 17 Nov 2020 21:55:58 +0100 Subject: [PATCH] Revert "Add logging for parser cache misses." We got the info we wanted, the statistics gathering is now just causing extra ParserCache lookups. This reverts commit dd81de53d7aa87dddc50a487089842dae46b84c9. This reverts commit 9a85a1b67e7cc39a8d4626f713112aca6ca0da37. Bug: T266200 Change-Id: I830797e287118fbde07e0e22e1304b30ee9f67e5 --- includes/TemplateDataHooks.php | 70 -------------------------------- includes/api/ApiTemplateData.php | 4 -- 2 files changed, 74 deletions(-) diff --git a/includes/TemplateDataHooks.php b/includes/TemplateDataHooks.php index d4114e8d..1dd40a2d 100644 --- a/includes/TemplateDataHooks.php +++ b/includes/TemplateDataHooks.php @@ -1,8 +1,4 @@ getStatus(); if ( !$status->isOK() ) { @@ -283,66 +275,4 @@ class TemplateDataHooks { ]; } } - - /** - * @unstable temporary addition to determine whether we can rely on the parser cache for - * storing the parsed TemplateData, instead of putting the data into the page_props table. - * - * @todo Remove once we have gathers sufficient data on live usage patterns (T266200). - * - * @param Title $title - */ - public static function logParserCacheStatus( Title $title ) { - $pageFactory = MediaWikiServices::getInstance()->getWikiPageFactory(); - $parserCache = MediaWikiServices::getInstance()->getParserCache(); - - $page = $pageFactory->newFromTitle( $title ); - $meta = $parserCache->getMetadata( $page ); - - $stats = MediaWikiServices::getInstance()->getStatsdDataFactory(); - $logger = LoggerFactory::getInstance( 'TemplateData' ); - - if ( $meta ) { - $stats->updateCount( 'templatedata.parsercache.hit', 1 ); - $logger->debug( 'Parser cache hit', [ - 'template-title' => $title->getPrefixedDBkey(), - ] ); - } else { - $stats->updateCount( 'templatedata.parsercache.miss', 1 ); - - $logger->info( 'Parser cache miss', [ - 'template-title' => $title->getPrefixedDBkey(), - ] ); - } - } - - /** - * @unstable temporary addition to determine whether we can rely on the parser cache for - * storing the parsed TemplateData, instead of putting the data into the page_props table. - * - * @todo Remove once we have gathers sufficient data on live usage patterns (T266200). - * - * @param Title[]|string[] $titles - * @param string $context - */ - public static function logBatchUsage( $titles, $context ) { - $stats = MediaWikiServices::getInstance()->getStatsdDataFactory(); - $logger = LoggerFactory::getInstance( 'TemplateData' ); - $size = count( $titles ); - - // magnitude buckets: 1 -> 0, 8 -> 1, 12 -> 2, 78 -> 2, 120 -> 3, ... - $magnitude = $size ? ceil( log10( $size ) ) : 0; - $stats->updateCount( 'templatedata.query.magnitude.' . $magnitude, 1 ); - - if ( $size < 2 ) { - $logger->debug( 'Single title query', [ - 'context' => $context, - ] ); - } else { - $logger->info( 'Batch query', [ - 'title-count' => $size, - 'context' => $context, - ] ); - } - } } diff --git a/includes/api/ApiTemplateData.php b/includes/api/ApiTemplateData.php index 6ec05445..4ea58328 100644 --- a/includes/api/ApiTemplateData.php +++ b/includes/api/ApiTemplateData.php @@ -69,8 +69,6 @@ class ApiTemplateData extends ApiBase { $titles = $pageSet->getGoodTitles(); // page_id => Title object $missingTitles = $pageSet->getMissingTitles(); // page_id => Title object - TemplateDataHooks::logBatchUsage( $pageSet->getTitles(), 'API' ); - $includeMissingTitles = $this->getParameter( 'includeMissingTitles' ); $doNotIgnoreMissingTitles = $this->getParameter( 'doNotIgnoreMissingTitles' ); if ( $doNotIgnoreMissingTitles ) { @@ -108,8 +106,6 @@ class ApiTemplateData extends ApiBase { ); foreach ( $res as $row ) { - TemplateDataHooks::logParserCacheStatus( $titles[$row->pp_page] ); - $rawData = $row->pp_value; $tdb = TemplateDataBlob::newFromDatabase( $db, $rawData ); $status = $tdb->getStatus();