Skip to content

Commit

Permalink
SiteStatsupdate: update to use StatsFactory
Browse files Browse the repository at this point in the history
Bug: T359243
Change-Id: If5f754054e469bdf11dc1446d7f43628dfda65b0
  • Loading branch information
shdubsh committed May 4, 2024
1 parent ea28749 commit e71c6f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions includes/deferred/SiteStatsUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,17 @@ public static function factory( array $deltas ) {

public function doUpdate() {
$services = MediaWikiServices::getInstance();
$stats = $services->getStatsdDataFactory();
$metric = $services->getStatsFactory()->getCounter( 'site_stats_total' );
$shards = $services->getMainConfig()->get( MainConfigNames::MultiShardSiteStats ) ?
self::SHARDS_ON : self::SHARDS_OFF;

$deltaByType = [];
foreach ( self::COUNTERS as $type ) {
$delta = $this->$type;
if ( $delta !== 0 ) {
$stats->updateCount( "site.$type", $delta );
$metric->setLabel( 'engagement', $type )
->copyToStatsdAt( "site.$type" )
->incrementBy( $delta );
}
$deltaByType[$type] = $delta;
}
Expand Down

0 comments on commit e71c6f7

Please sign in to comment.