jenkins-bot has submitted this change and it was merged.

Change subject: Add performance instrumentation test settings
......................................................................


Add performance instrumentation test settings

Amended tests/mocha/apitest.localsettings.js and tests/rttest.localsettings.js
to include a noop function and performance instrumentation test settings.
Amended node-txstatsd instantiation in lib/mediawiki.ParsoidConfig.js to
include these changes. Also renamed toggle 'parsoidConfig.usePerformanceTimer'
to 'parsoidConfig.useDefaultPerformanceTimer' in api/localsettings.js.example,
lib/mediawiki.ParsoidConfig.js, tests/mocha/apitest.localsettings.js and
tests/rttest.localsettings.js.

Change-Id: I5d50a5422861cc94ebd726b3389dab4d6db30ac3
---
M api/localsettings.js.example
M lib/mediawiki.ParsoidConfig.js
M tests/mocha/apitest.localsettings.js
M tests/rttest.localsettings.js
4 files changed, 22 insertions(+), 4 deletions(-)

Approvals:
  Arlolra: Looks good to me, but someone else must approve
  Subramanya Sastry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/api/localsettings.js.example b/api/localsettings.js.example
index 272c899..99e3a54 100644
--- a/api/localsettings.js.example
+++ b/api/localsettings.js.example
@@ -39,7 +39,7 @@
        //parsoidConfig.allowCORS = 'some.domain.org';
 
        // Set to true for Performance timing
-       //parsoidConfig.usePerformanceTimer = true;
+       //parsoidConfig.useDefaultPerformanceTimer = true;
        // Peformance timing options
        //parsoidConfig.txstatsdHost = 'statsd.eqiad.wmnet';
        //parsoidConfig.txstatsdPort = 8125;
diff --git a/lib/mediawiki.ParsoidConfig.js b/lib/mediawiki.ParsoidConfig.js
index 788663d..28b4da7 100644
--- a/lib/mediawiki.ParsoidConfig.js
+++ b/lib/mediawiki.ParsoidConfig.js
@@ -53,10 +53,8 @@
        this.allowCORS = '*';
 
        // Timer that reports metrics to statsd
-       if ( this.usePerformanceTimer ){
+       if ( this.useDefaultPerformanceTimer ){
                this.performanceTimer = new Util.StatsD( this.txstatsdHost, 
this.txstatsdPort );
-       } else {
-               this.performanceTimer = null;
        }
 }
 
@@ -294,6 +292,10 @@
        });
 };
 
+/**
+ * @property {null} Settings for Performance timer.
+ */
+ParsoidConfig.prototype.performanceTimer = null;
 
 if (typeof module === "object") {
        module.exports.ParsoidConfig = ParsoidConfig;
diff --git a/tests/mocha/apitest.localsettings.js 
b/tests/mocha/apitest.localsettings.js
index d7694dc..e071d93 100644
--- a/tests/mocha/apitest.localsettings.js
+++ b/tests/mocha/apitest.localsettings.js
@@ -57,4 +57,12 @@
        // Leaving it undefined (the default) will use the same URI as the MW 
API,
        // changing api.php for load.php.
        //parsoidConfig.modulesLoadURI = true;
+
+       // Set to true to enable Performance timing
+       parsoidConfig.useDefaultPerformanceTimer = false;
+       // Peformance timing options for testing
+       parsoidConfig.performanceTimer = {
+               count: function() {},
+               timing: function() {}
+       };
 };
diff --git a/tests/rttest.localsettings.js b/tests/rttest.localsettings.js
index e4d51e9..75d9c9f 100644
--- a/tests/rttest.localsettings.js
+++ b/tests/rttest.localsettings.js
@@ -63,4 +63,12 @@
 
        // Fetch the wikitext for a page before doing html2wt
        parsoidConfig.fetchWT = true;
+
+       // Set to true to enable Performance timing
+       parsoidConfig.useDefaultPerformanceTimer = false;
+       // Peformance timing options for testing
+       parsoidConfig.performanceTimer = {
+               count: function() {},
+               timing: function() {}
+       };
 };

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5d50a5422861cc94ebd726b3389dab4d6db30ac3
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Memeht <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: Memeht <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to