Count edit conflicts for each namespace separately
authoraddshore <addshorewiki@gmail.com>
Thu, 14 Jul 2016 15:23:14 +0000 (16:23 +0100)
committerReedy <reedy@wikimedia.org>
Mon, 25 Jul 2016 21:11:29 +0000 (21:11 +0000)
Bug: T140368
Change-Id: I5591f53063db32b2c74a2f74751d4af0ef5424d7

includes/EditPage.php

index 362f905..fa5c53d 100644 (file)
@@ -3536,13 +3536,12 @@ HTML
                if ( Hooks::run( 'EditPageBeforeConflictDiff', [ &$this, &$wgOut ] ) ) {
                        $stats = $wgOut->getContext()->getStats();
                        $stats->increment( 'edit.failures.conflict' );
-                       if ( $this->mTitle->isTalkPage() ) {
-                               $stats->increment( 'edit.failures.conflict.byType.talk' );
-                       } else {
-                               $stats->increment( 'edit.failures.conflict.byType.subject' );
-                       }
-                       if ( $this->mTitle->getNamespace() === NS_PROJECT ) {
-                               $stats->increment( 'edit.failures.conflict.byNamespace.project' );
+                       // Only include 'standard' namespaces to avoid creating unknown numbers of statsd metrics
+                       if (
+                               $this->mTitle->getNamespace() >= NS_MAIN &&
+                               $this->mTitle->getNamespace() <= NS_CATEGORY_TALK
+                       ) {
+                               $stats->increment( 'edit.failures.conflict.byNamespaceId.' . $this->mTitle->getNamespace() );
                        }
 
                        $wgOut->wrapWikiMsg( '<h2>$1</h2>', "yourdiff" );