jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/398333 )

Change subject: ArticleTargetEvents: Track editor mode on save events
......................................................................


ArticleTargetEvents: Track editor mode on save events

Bug: T182610
Change-Id: I8b58bea8e4444478cde4c1340d13ddf97aab8f01
---
M lib/ve
M modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js
2 files changed, 30 insertions(+), 19 deletions(-)

Approvals:
  Esanders: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/ve b/lib/ve
index cd6bce1..bafb26b 160000
--- a/lib/ve
+++ b/lib/ve
@@ -1 +1 @@
-Subproject commit cd6bce192f313cc4670bee1b66197f4ff1b8b2ce
+Subproject commit bafb26b25c42914452b46d787331f6f4edaa263c
diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js 
b/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js
index f3e9fd2..0f4584b 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js
@@ -51,9 +51,20 @@
  * @param {Object} data Additional data describing the event, encoded as an 
object
  */
 ve.init.mw.ArticleTargetEvents.prototype.track = function ( topic, data ) {
+       ve.track( topic, $.extend( {
+               mode: this.target.surface ? this.target.surface.getMode() : 
this.target.getDefaultMode()
+       }, data ) );
+};
+
+/**
+ * Target specific ve.track wrapper, focused on mwtiming
+ *
+ * @param {string} topic Event name
+ * @param {Object} data Additional data describing the event, encoded as an 
object
+ */
+ve.init.mw.ArticleTargetEvents.prototype.trackTiming = function ( topic, data 
) {
        data.targetName = this.target.constructor.static.trackingName;
-       data.mode = this.target.surface ? this.target.surface.getMode() : 
this.target.getDefaultMode();
-       ve.track( 'mwtiming.' + topic, data );
+       this.track( 'mwtiming.' + topic, data );
 
        if ( topic.indexOf( 'performance.system.serializeforcache' ) === 0 ) {
                // HACK: track serializeForCache duration here, because there's 
no event for that
@@ -66,17 +77,17 @@
  */
 ve.init.mw.ArticleTargetEvents.prototype.onSaveWorkflowBegin = function () {
        this.timings.saveWorkflowBegin = ve.now();
-       this.track( 'behavior.lastTransactionTillSaveDialogOpen', {
+       this.trackTiming( 'behavior.lastTransactionTillSaveDialogOpen', {
                duration: this.timings.saveWorkflowBegin - 
this.timings.lastTransaction
        } );
-       ve.track( 'mwedit.saveIntent' );
+       this.track( 'mwedit.saveIntent' );
 };
 
 /**
  * Track when user ends the save workflow
  */
 ve.init.mw.ArticleTargetEvents.prototype.onSaveWorkflowEnd = function () {
-       this.track( 'behavior.saveDialogClose', { duration: ve.now() - 
this.timings.saveWorkflowBegin } );
+       this.trackTiming( 'behavior.saveDialogClose', { duration: ve.now() - 
this.timings.saveWorkflowBegin } );
        this.timings.saveWorkflowBegin = null;
 };
 
@@ -86,10 +97,10 @@
 ve.init.mw.ArticleTargetEvents.prototype.onSaveInitiated = function () {
        this.timings.saveInitiated = ve.now();
        this.timings.saveRetries++;
-       this.track( 'behavior.saveDialogOpenTillSave', {
+       this.trackTiming( 'behavior.saveDialogOpenTillSave', {
                duration: this.timings.saveInitiated - 
this.timings.saveWorkflowBegin
        } );
-       ve.track( 'mwedit.saveAttempt' );
+       this.track( 'mwedit.saveAttempt' );
 };
 
 /**
@@ -100,9 +111,9 @@
  * @param {number} newRevId
  */
 ve.init.mw.ArticleTargetEvents.prototype.onSaveComplete = function ( content, 
categoriesHtml, newRevId ) {
-       this.track( 'performance.user.saveComplete', { duration: ve.now() - 
this.timings.saveInitiated } );
+       this.trackTiming( 'performance.user.saveComplete', { duration: ve.now() 
- this.timings.saveInitiated } );
        this.timings.saveRetries = 0;
-       ve.track( 'mwedit.saveSuccess', {
+       this.track( 'mwedit.saveSuccess', {
                timing: ve.now() - this.timings.saveInitiated + ( 
this.timings.serializeForCache || 0 ),
                'page.revid': newRevId
        } );
@@ -142,7 +153,7 @@
        if ( specialTypes.indexOf( type ) !== -1 ) {
                key += '.' + type;
        }
-       this.track( key, {
+       this.trackTiming( key, {
                duration: ve.now() - this.timings.saveInitiated,
                retries: this.timings.saveRetries,
                type: type
@@ -155,7 +166,7 @@
        if ( type === 'unknown' && failureArguments[ 0 ] ) {
                data.message = failureArguments[ 0 ];
        }
-       ve.track( 'mwedit.saveFailure', data );
+       this.track( 'mwedit.saveFailure', data );
 };
 
 /**
@@ -171,7 +182,7 @@
  * Record activation being complete.
  */
 ve.init.mw.ArticleTargetEvents.prototype.trackActivationComplete = function () 
{
-       this.track( 'performance.system.activation', { duration: ve.now() - 
this.timings.activationStart } );
+       this.trackTiming( 'performance.system.activation', { duration: ve.now() 
- this.timings.activationStart } );
 };
 
 /**
@@ -186,7 +197,7 @@
  */
 ve.init.mw.ArticleTargetEvents.prototype.onSaveReview = function () {
        this.timings.saveReview = ve.now();
-       this.track( 'behavior.saveDialogOpenTillReview', {
+       this.trackTiming( 'behavior.saveDialogOpenTillReview', {
                duration: this.timings.saveReview - 
this.timings.saveWorkflowBegin
        } );
 };
@@ -201,28 +212,28 @@
  * Track when the user enters the review workflow
  */
 ve.init.mw.ArticleTargetEvents.prototype.onShowChanges = function () {
-       this.track( 'performance.user.reviewComplete', { duration: ve.now() - 
this.timings.saveReview } );
+       this.trackTiming( 'performance.user.reviewComplete', { duration: 
ve.now() - this.timings.saveReview } );
 };
 
 /**
  * Track when the diff request fails in the review workflow
  */
 ve.init.mw.ArticleTargetEvents.prototype.onShowChangesError = function () {
-       this.track( 'performance.user.reviewError', { duration: ve.now() - 
this.timings.saveReview } );
+       this.trackTiming( 'performance.user.reviewError', { duration: ve.now() 
- this.timings.saveReview } );
 };
 
 /**
  * Track when the diff request detects no changes
  */
 ve.init.mw.ArticleTargetEvents.prototype.onNoChanges = function () {
-       this.track( 'performance.user.reviewComplete', { duration: ve.now() - 
this.timings.saveReview } );
+       this.trackTiming( 'performance.user.reviewComplete', { duration: 
ve.now() - this.timings.saveReview } );
 };
 
 /**
  * Track when serialization is complete in review workflow
  */
 ve.init.mw.ArticleTargetEvents.prototype.onSerializeComplete = function () {
-       this.track( 'performance.user.reviewComplete', { duration: ve.now() - 
this.timings.saveReview } );
+       this.trackTiming( 'performance.user.reviewComplete', { duration: 
ve.now() - this.timings.saveReview } );
 };
 
 /**
@@ -232,6 +243,6 @@
        if ( this.timings.saveWorkflowBegin ) {
                // This function can be called by the switch to wikitext button 
as well, so only log
                // reviewError if we actually got here from the save workflow
-               this.track( 'performance.user.reviewError', { duration: 
ve.now() - this.timings.saveReview } );
+               this.trackTiming( 'performance.user.reviewError', { duration: 
ve.now() - this.timings.saveReview } );
        }
 };

-- 
To view, visit https://gerrit.wikimedia.org/r/398333
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8b58bea8e4444478cde4c1340d13ddf97aab8f01
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch <[email protected]>
Gerrit-Reviewer: DLynch <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to