Aaron Schulz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/357661 )

Change subject: Add edit.newContentSize statsd metric
......................................................................

Add edit.newContentSize statsd metric

Also clean up the method docs and return value

Change-Id: I7f44cbdb1b691182ebbdb1508886bc5e4f2ee9d0
---
M WikimediaEventsHooks.php
1 file changed, 18 insertions(+), 7 deletions(-)


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

diff --git a/WikimediaEventsHooks.php b/WikimediaEventsHooks.php
index 958c1e5..7e0b980 100644
--- a/WikimediaEventsHooks.php
+++ b/WikimediaEventsHooks.php
@@ -59,25 +59,38 @@
 
        /**
         * Log server-side event on successful page edit.
+        *
+        * Imported from EventLogging extension
+        *
+        * @param WikiPage $article
+        * @param User $user
+        * @param Content $content
+        * @param string $summary
+        * @param bool $isMinor
+        * @param bool $isWatch
+        * @param string $section
+        * @param int $flags
         * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/PageContentSaveComplete
         * @see https://meta.wikimedia.org/wiki/Schema:PageContentSaveComplete
         */
-       // Imported from EventLogging extension
-       public static function onPageContentSaveComplete( $article, $user, 
$content, $summary,
-               $isMinor, $isWatch, $section, $flags, $revision, $status, 
$baseRevId ) {
-
+       public static function onPageContentSaveComplete(
+               $article, $user, $content, $summary,
+               $isMinor, $isWatch, $section, $flags, $revision
+       ) {
                if ( !$revision ) {
                        return;
                }
 
                $stats = 
MediaWikiServices::getInstance()->getStatsdDataFactory();
                if ( PHP_SAPI !== 'cli' ) {
-                       DeferredUpdates::addCallableUpdate( function () use ( 
$stats ) {
+                       $size = $content->getSize();
+                       DeferredUpdates::addCallableUpdate( function () use ( 
$stats, $size ) {
                                $timing = 
RequestContext::getMain()->getTiming();
                                $measure = $timing->measure( 
'editResponseTime', 'requestStart', 'requestShutdown' );
                                if ( $measure !== false ) {
                                        $stats->timing( 
'timing.editResponseTime', $measure['duration'] * 1000 );
                                }
+                               $stats->gauge( 'edit.newContentSize', $size );
                        } );
                }
 
@@ -130,8 +143,6 @@
                                        'isMobile'  => $isMobile,
                                ] );
                }
-
-               return true;
        }
 
        /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f44cbdb1b691182ebbdb1508886bc5e4f2ee9d0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to