[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Add some metrics to the http api to count the original version

2017-12-13 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/397647 )

Change subject: Add some metrics to the http api to count the original version
..


Add some metrics to the http api to count the original version

Change-Id: I63316e525d8a8f1569868283f981391b831b7f94
---
M lib/api/routes.js
1 file changed, 7 insertions(+), 1 deletion(-)

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



diff --git a/lib/api/routes.js b/lib/api/routes.js
index a2a5f56..d36b083 100644
--- a/lib/api/routes.js
+++ b/lib/api/routes.js
@@ -443,9 +443,12 @@
} else if (original && original.html) {
env.originalVersion = 
apiUtils.versionFromType(original.html);
if (env.originalVersion === null) {
-   // Or, should we check for a meta in the 
original html?
return apiUtils.fatalRequest(env, 'Content-type 
of original html is missing.', 400);
}
+   }
+   if (metrics) {
+   var ver = env.hasOwnProperty('originalVersion') ? 
env.originalVersion : 'default';
+   metrics.increment('html2wt.original.version.' + ver);
}
 
var pb, origPb;
@@ -553,6 +556,9 @@
if (env.originalVersion === null) {
return apiUtils.fatalRequest(env, 'Content-type of 
revision html is missing.', 400);
}
+   if (metrics) {
+   metrics.increment('pb2pb.original.version.' + 
env.originalVersion);
+   }
 
var contentmodel = (revision && revision.contentmodel);
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I63316e525d8a8f1569868283f981391b831b7f94
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra 
Gerrit-Reviewer: Arlolra 
Gerrit-Reviewer: C. Scott Ananian 
Gerrit-Reviewer: Sbailey 
Gerrit-Reviewer: Subramanya Sastry 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...parsoid[master]: Add some metrics to the http api to count the original version

2017-12-11 Thread Arlolra (Code Review)
Arlolra has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397647 )

Change subject: Add some metrics to the http api to count the original version
..

Add some metrics to the http api to count the original version

Change-Id: I63316e525d8a8f1569868283f981391b831b7f94
---
M lib/api/routes.js
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid 
refs/changes/47/397647/1

diff --git a/lib/api/routes.js b/lib/api/routes.js
index a2a5f56..d36b083 100644
--- a/lib/api/routes.js
+++ b/lib/api/routes.js
@@ -443,9 +443,12 @@
} else if (original && original.html) {
env.originalVersion = 
apiUtils.versionFromType(original.html);
if (env.originalVersion === null) {
-   // Or, should we check for a meta in the 
original html?
return apiUtils.fatalRequest(env, 'Content-type 
of original html is missing.', 400);
}
+   }
+   if (metrics) {
+   var ver = env.hasOwnProperty('originalVersion') ? 
env.originalVersion : 'default';
+   metrics.increment('html2wt.original.version.' + ver);
}
 
var pb, origPb;
@@ -553,6 +556,9 @@
if (env.originalVersion === null) {
return apiUtils.fatalRequest(env, 'Content-type of 
revision html is missing.', 400);
}
+   if (metrics) {
+   metrics.increment('pb2pb.original.version.' + 
env.originalVersion);
+   }
 
var contentmodel = (revision && revision.contentmodel);
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63316e525d8a8f1569868283f981391b831b7f94
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Arlolra 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits