mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-09-23 10:22:05 +00:00
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
This commit is contained in:
parent
286aab802d
commit
480f8863c6
|
@ -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 ) {
|
||||
|
|
Loading…
Reference in a new issue