mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Set targetName for apiLoad and restbaseLoad metrics to the correct values again
If70ff601 didn't really fix anything. The only reason you'd want this data is to distinguish between mobile and desktop data, but it just set the value to the desktop version always... Bug: T95432 Change-Id: I76722e3ad8b7dbe644374b24093bec696f27f48c
This commit is contained in:
parent
8000633fee
commit
19dc7d31fe
|
@ -129,7 +129,8 @@
|
|||
.then( function () {
|
||||
return mw.libs.ve.targetLoader.requestPageData(
|
||||
mw.config.get( 'wgRelevantPageName' ),
|
||||
uri.query.oldid
|
||||
uri.query.oldid,
|
||||
'mwTarget' // ve.init.mw.ViewPageTarget.static.name
|
||||
);
|
||||
} );
|
||||
|
||||
|
|
|
@ -919,7 +919,11 @@ ve.init.mw.Target.prototype.load = function ( dataPromise ) {
|
|||
}
|
||||
this.events.timings.activationStart = ve.now();
|
||||
|
||||
this.loading = dataPromise || mw.libs.ve.targetLoader.requestPageData( this.pageName, this.requestedRevId );
|
||||
this.loading = dataPromise || mw.libs.ve.targetLoader.requestPageData(
|
||||
this.pageName,
|
||||
this.requestedRevId,
|
||||
this.constructor.name
|
||||
);
|
||||
this.loading
|
||||
.done( ve.init.mw.Target.onLoad.bind( this ) )
|
||||
.fail( ve.init.mw.Target.onLoadError.bind( this ) );
|
||||
|
|
|
@ -87,7 +87,7 @@
|
|||
* Request the page HTML and various metadata from the MediaWiki API and Parsoid.
|
||||
* @return {jQuery.Promise} Abortable promise resolved with a JSON object
|
||||
*/
|
||||
requestPageData: function ( pageName, oldid ) {
|
||||
requestPageData: function ( pageName, oldid, targetName ) {
|
||||
var start, apiXhr, restbaseXhr, apiPromise, restbasePromise, dataPromise,
|
||||
data = {
|
||||
action: 'visualeditor',
|
||||
|
@ -113,7 +113,8 @@
|
|||
ve.track( 'mwtiming.performance.system.apiLoad', {
|
||||
bytes: $.byteLength( jqxhr.responseText ),
|
||||
duration: ve.now() - start,
|
||||
cacheHit: /hit/i.test( jqxhr.getResponseHeader( 'X-Cache' ) )
|
||||
cacheHit: /hit/i.test( jqxhr.getResponseHeader( 'X-Cache' ) ),
|
||||
targetName: targetName
|
||||
} );
|
||||
return data;
|
||||
} );
|
||||
|
@ -131,7 +132,8 @@
|
|||
ve.track( 'trace.restbaseLoad.exit' );
|
||||
ve.track( 'mwtiming.performance.system.restbaseLoad', {
|
||||
bytes: $.byteLength( jqxhr.responseText ),
|
||||
duration: ve.now() - start
|
||||
duration: ve.now() - start,
|
||||
targetName: targetName
|
||||
} );
|
||||
return data;
|
||||
},
|
||||
|
|
|
@ -133,15 +133,13 @@
|
|||
} );
|
||||
|
||||
ve.trackSubscribe( 'mwtiming.', function ( topic, data ) {
|
||||
var target;
|
||||
// Add type for save errors; not in the topic for stupid historical reasons
|
||||
if ( topic === 'mwtiming.performance.user.saveError' ) {
|
||||
topic = topic + '.' + data.type;
|
||||
}
|
||||
|
||||
target = data.targetName || 'mwTarget';
|
||||
// Map mwtiming.foo --> timing.ve.foo.mobile
|
||||
topic = topic.replace( /^mwtiming/, 'timing.ve.' + target );
|
||||
topic = topic.replace( /^mwtiming/, 'timing.ve.' + data.targetName );
|
||||
mw.track( topic, data.duration );
|
||||
} );
|
||||
|
||||
|
|
Loading…
Reference in a new issue