Ori.livneh has submitted this change and it was merged.
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
(cherry picked from commit 4e2cfb51f1848ace2265f41fd6888522e480b75d)
---
M NavigationTiming.php
M modules/ext.navigationTiming.js
2 files changed, 28 insertions(+), 7 deletions(-)
Approvals:
Ori.livneh: Verified; Looks good to me, approved
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..ef62be6 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,28 @@
mw.eventLog.logEvent( 'NavigationTiming', event );
}
- if ( inSample() ) {
- // Ensure we run after loadEventEnd.
- $( window ).load( function () {
- setTimeout( emitTiming );
- } );
+ function emitSaveTiming() {
+ 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/164423
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia879fa1dccc4ead7239eab916bae03178fe8064f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/NavigationTiming
Gerrit-Branch: wmf/1.25wmf2
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits