Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/164412
Change subject: Log save time
......................................................................
Log save time
Log SaveTiming events, measuring the time it took an edit to be processed
(indicated as time between form submission and the arrival of the first byte of
the response containing the updated page.)
Change-Id: Ia879fa1dccc4ead7239eab916bae03178fe8064f
---
M NavigationTiming.php
M modules/ext.navigationTiming.js
2 files changed, 29 insertions(+), 7 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/NavigationTiming
refs/changes/12/164412/1
diff --git a/NavigationTiming.php b/NavigationTiming.php
index 9fc1027..37e4aec 100644
--- a/NavigationTiming.php
+++ b/NavigationTiming.php
@@ -37,12 +37,16 @@
'scripts' => 'ext.navigationTiming.js',
'localBasePath' => __DIR__ . '/modules',
'remoteExtPath' => 'NavigationTiming/modules',
- 'dependencies' => 'schema.NavigationTiming',
+ 'dependencies' => array(
+ 'schema.NavigationTiming',
+ 'schema.SaveTiming',
+ ),
'targets' => array( 'desktop', 'mobile' ),
)
);
$wgEventLoggingSchemas[ 'NavigationTiming' ] = 10076863;
+$wgEventLoggingSchemas[ 'SaveTiming' ] = 10077760;
$wgHooks[ 'BeforePageDisplay' ][] = function ( &$out, &$skin ) {
$out->addModules( 'ext.navigationTiming' );
diff --git a/modules/ext.navigationTiming.js b/modules/ext.navigationTiming.js
index cb45768..bf2066c 100644
--- a/modules/ext.navigationTiming.js
+++ b/modules/ext.navigationTiming.js
@@ -156,7 +156,7 @@
return {};
}
- function emitTiming() {
+ function emitNavigationTiming() {
var event = getMediaWikiTiming();
// The Navigation Timing API provides an attribute that can be
used to
@@ -173,11 +173,29 @@
mw.eventLog.logEvent( 'NavigationTiming', event );
}
- if ( inSample() ) {
- // Ensure we run after loadEventEnd.
- $( window ).load( function () {
- setTimeout( emitTiming );
- } );
+ function emitSaveTiming() {
+ var event;
+ if (
+ mw.config.get( 'wgPostEdit' )
+ && isCompliant()
+ && performance.navigation.type === 0
+ && performance.timing.navigationStart > 0
+ ) {
+ mw.eventLog.logEvent( 'SaveTiming', {
+ duration: performance.timing.responseStart -
performance.timing.navigationStart,
+ runtime: mw.config.get( 'wgPoweredByHHVM' ) ?
'HHVM' : 'PHP5'
+ } );
+ }
}
+ // Ensure we run after loadEventEnd.
+ $( window ).load( function () {
+ setTimeout( function () {
+ if ( inSample() ) {
+ emitNavigationTiming();
+ }
+ mw.hook( 'postEdit' ).add( emitSaveTiming );
+ } );
+ } );
+
} ( mediaWiki, jQuery ) );
--
To view, visit https://gerrit.wikimedia.org/r/164412
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia879fa1dccc4ead7239eab916bae03178fe8064f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/NavigationTiming
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits