mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-24 02:38:40 +00:00
Strip X-Parsoid Performance Headers from Visual Editor
Stripped out X-Parsoid Performance Headers, previously used to gather and forward Parsoid's performance information, from ApiVisualEditor.php, ve.init.mw.Target.js and ve.init.mw.TargetLoader.js. Change I936ada7b1 strips out the corresponding X-Parsoid Performance Headers from Parsoid. Parsoid's current performance instrumentation is achieved using Graphite and txstatsd. Change-Id: I57d6f866a7d8287a5115e6236b0fb25bc4d0eabd
This commit is contained in:
parent
9962663f81
commit
175e60edaf
|
@ -90,19 +90,16 @@ class ApiVisualEditor extends ApiBase {
|
|||
}
|
||||
$response = $this->serviceClient->run( $request );
|
||||
if ( $response['code'] === 200 && $response['error'] === "" ) {
|
||||
// Pass thru performance data from Parsoid to the client, unless the response was
|
||||
// served directly from Varnish, in which case discard the value of the XPP header
|
||||
// and use it to declare the cache hit instead.
|
||||
// If response was served directly from Varnish, use the response
|
||||
// (RP) header to declare the cache hit and pass the data to the client.
|
||||
$headers = $response['headers'];
|
||||
$xpp = null;
|
||||
$rp = null;
|
||||
if ( isset( $headers['x-cache'] ) && strpos( $headers['x-cache'], 'hit' ) !== false ) {
|
||||
$xpp = 'cached-response=true';
|
||||
} elseif ( isset( $headers['x-parsoid-performance'] ) ) {
|
||||
$xpp = $headers['x-parsoid-performance'];
|
||||
$rp = 'cached-response=true';
|
||||
}
|
||||
if ( $xpp !== null ) {
|
||||
if ( $rp !== null ) {
|
||||
$resp = $this->getRequest()->response();
|
||||
$resp->header( 'X-Parsoid-Performance: ' . $xpp );
|
||||
$resp->header( 'X-Cache: ' . $rp );
|
||||
}
|
||||
} elseif ( $response['error'] !== '' ) {
|
||||
$this->dieUsage( 'parsoidserver-http-error: ' . $response['error'], $response['error'] );
|
||||
|
|
|
@ -1095,8 +1095,7 @@ ve.init.mw.Target.prototype.tryWithPreparedCacheKey = function ( doc, options, e
|
|||
function ( response, jqxhr ) {
|
||||
var eventData = {
|
||||
bytes: $.byteLength( jqxhr.responseText ),
|
||||
duration: ve.now() - start,
|
||||
parsoid: jqxhr.getResponseHeader( 'X-Parsoid-Performance' )
|
||||
duration: ve.now() - start
|
||||
};
|
||||
|
||||
// Log data about the request if eventName was set
|
||||
|
@ -1112,8 +1111,7 @@ ve.init.mw.Target.prototype.tryWithPreparedCacheKey = function ( doc, options, e
|
|||
if ( errorObject && errorObject.xhr ) {
|
||||
eventData = {
|
||||
bytes: $.byteLength( errorObject.xhr.responseText ),
|
||||
duration: ve.now() - start,
|
||||
parsoid: errorObject.xhr.getResponseHeader( 'X-Parsoid-Performance' )
|
||||
duration: ve.now() - start
|
||||
};
|
||||
|
||||
if ( eventName ) {
|
||||
|
|
|
@ -121,8 +121,7 @@
|
|||
ve.track( 'mwtiming.performance.system.apiLoad', {
|
||||
bytes: $.byteLength( jqxhr.responseText ),
|
||||
duration: ve.now() - start,
|
||||
cacheHit: /hit/i.test( jqxhr.getResponseHeader( 'X-Cache' ) ),
|
||||
parsoid: jqxhr.getResponseHeader( 'X-Parsoid-Performance' )
|
||||
cacheHit: /hit/i.test( jqxhr.getResponseHeader( 'X-Cache' ) )
|
||||
} );
|
||||
return data;
|
||||
} );
|
||||
|
|
Loading…
Reference in a new issue