MaxSem has uploaded a new change for review.

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

Change subject: Record sum of all wikis for geo tag counts
......................................................................

Record sum of all wikis for geo tag counts

Change-Id: I5f78e4dba33bc28532e0187c34cf2811dec4eceb
---
M geo-tag-counts.php
1 file changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/analytics/discovery-stats 
refs/changes/22/324822/1

diff --git a/geo-tag-counts.php b/geo-tag-counts.php
index 926f705..93d4268 100644
--- a/geo-tag-counts.php
+++ b/geo-tag-counts.php
@@ -16,6 +16,8 @@
 );
 $graphite = new Graphite( $config );
 
+$pages = 0;
+$content = 0;
 foreach ( $matrix->getSites() as $site ) {
     $dbName = $site->getDbName();
     // Can't quote it, have to validate
@@ -31,6 +33,7 @@
 
     $res = query( 'SELECT count(*) AS num FROM geo_tags WHERE gt_primary=1' );
     if ( $res && ( $row = $res->fetch() ) ) {
+        $pages += $row['num'];
         $graphite->record( "geodata.pages.$siteKey.hourly", $row['num'] );
     }
 
@@ -42,10 +45,14 @@
         . "AND page_namespace IN ($ns) AND gt_primary=1"
     );
     if ( $res && ( $row = $res->fetch() ) ) {
+        $content += $row['num'];
         $graphite->record( "geodata.content.$siteKey.hourly", $row['num'] );
     }
 }
 
+$graphite->record( "geodata.pages.all.hourly", $pages );
+$graphite->record( "geodata.content.all.hourly", $content );
+
 function query( $sql ) {
     global $db;
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5f78e4dba33bc28532e0187c34cf2811dec4eceb
Gerrit-PatchSet: 1
Gerrit-Project: analytics/discovery-stats
Gerrit-Branch: master
Gerrit-Owner: MaxSem <maxsem.w...@gmail.com>

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

Reply via email to