Ori.livneh has uploaded a new change for review.

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

Change subject: Add stats for editor milestones
......................................................................

Add stats for editor milestones

Keep track of the rate at which editors are hitting milestones, which are
defined as powers-of-ten edit counts (1, 10, 100, 1000...). It's an interesting
measure of community health.

Change-Id: I5240017421bd0c61af52619e11c0c32f447c8f84
---
M WikimediaEventsHooks.php
1 file changed, 12 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents 
refs/changes/15/225015/1

diff --git a/WikimediaEventsHooks.php b/WikimediaEventsHooks.php
index faea612..5db11a2 100644
--- a/WikimediaEventsHooks.php
+++ b/WikimediaEventsHooks.php
@@ -84,12 +84,19 @@
                $age = time() - wfTimestampOrNull( TS_UNIX, 
$user->getRegistration() );
 
                $editCount = $user->getEditCount();
-
-               if ( $editCount === 0 ) {
-                       // It's the user's first edit! Report the time elapsed 
since the
-                       // user registered as "ttfe" ("time to first edit").
+               // Check if this edit brings the user's total edit count to a 
value
+               // that is a factor of ten. We consider these 'milestones'. The 
rate
+               // at which editors are hitting such milestones is one 
indicator of
+               // community health.
+               if ( $editCount === 0 || preg_match( '/^9+$/' , "$editCount" ) 
) {
+                       $milestone = $editCount + 1;
                        $stats = RequestContext::getMain()->getStats();
-                       $stats->timing( 'ttfe', $age );
+                       $stats->increment( "editor.milestones.{$milestone}" );
+                       if ( $editCount === 0 ) {
+                               // It's the user's first edit! Report the time 
elapsed since the
+                               // user registered as "ttfe" ("time to first 
edit").
+                               $stats->timing( 'ttfe', $age );
+                       }
                }
 
                // If the editor signed up in the last thirty days, and if this 
is an

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5240017421bd0c61af52619e11c0c32f447c8f84
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
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