jenkins-bot has submitted this change and it was merged.

Change subject: Add intermediate metrics for API and ext.echo.ui loading 
response times
......................................................................


Add intermediate metrics for API and ext.echo.ui loading response times

And add a FIXME for our existing metric possibly being wrong if the API
request finishes before the ext.echo.ui module is loaded.

Change-Id: I918187dd276193b7602f60527b423ca06cb7e2d0
---
M modules/ext.echo.init.js
1 file changed, 9 insertions(+), 1 deletion(-)

Approvals:
  Mooeypoo: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ext.echo.init.js b/modules/ext.echo.init.js
index db77e27..e044818 100644
--- a/modules/ext.echo.init.js
+++ b/modules/ext.echo.init.js
@@ -40,7 +40,11 @@
                        $( this ).addClass( 
'mw-echo-notifications-badge-dimmed' );
 
                        // Fire the notification API requests
-                       apiRequest = new mw.Api( { ajax: { cache: false } } 
).get( $.extend( { notsections: myType }, mw.echo.apiCallParams ) );
+                       apiRequest = new mw.Api( { ajax: { cache: false } } 
).get( $.extend( { notsections: myType }, mw.echo.apiCallParams ) )
+                                       .then( function ( data ) {
+                                               mw.track( 
'timing.MediaWiki.echo.overlay.api', mw.now() - time );
+                                               return data;
+                                       } );
 
                        // Load the ui
                        mw.loader.using( 'ext.echo.ui', function () {
@@ -88,9 +92,13 @@
                                myWidget = myType === 'alert' ? 
mw.echo.ui.alertWidget : mw.echo.ui.messageWidget;
                                myWidget.populateNotifications( apiRequest 
).then( function () {
                                        // Log timing after notifications are 
shown
+                                       // FIXME: The notifications might not 
be shown yet if the API
+                                       // request finished before the UI 
loads, in which case it will
+                                       // only be shown after the toggle( true 
) call below.
                                        mw.track( 
'timing.MediaWiki.echo.overlay', mw.now() - time );
                                } );
                                myWidget.popup.toggle( true );
+                               mw.track( 'timing.MediaWiki.echo.overlay.ooui', 
mw.now() - time );
                        } );
 
                        if ( hasUnseenAlerts || hasUnseenMessages ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I918187dd276193b7602f60527b423ca06cb7e2d0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>
Gerrit-Reviewer: Mooeypoo <mor...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to