You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by gi...@git.apache.org on 2017/06/19 16:45:11 UTC

[GitHub] bjustin-ibm commented on a change in pull request #105: Add system stats and basic auth to the health endpoint

bjustin-ibm commented on a change in pull request #105: Add system stats and basic auth to the health endpoint
URL: https://github.com/apache/incubator-openwhisk-package-cloudant/pull/105#discussion_r122759802
 
 

 ##########
 File path: provider/lib/health.js
 ##########
 @@ -1,11 +1,39 @@
-module.exports = function(providerUtils) {
+var si = require('systeminformation');
 
-  // Health Endpoint
-  this.endPoint = '/health';
+module.exports = function(utils) {
 
-  // Health Logic
-  this.health = function (req, res) {
-      res.send({triggerCount: Object.keys(providerUtils.triggers).length});
-  };
+    // Health Endpoint
+    this.endPoint = '/health';
+    var stats = {triggerCount: Object.keys(utils.triggers).length};
+
+    // Health Logic
+    this.health = function (req, res) {
 
 Review comment:
   Each of these `si` calls are async and potentially time consuming. They also do not depend on each other... for example, the call to `si.currentLoad()` doesn't actually depend on the result of calling `si.mem()`. I suggest queueing these up into a Promise array then using `Promise.all()` to collect the results. This will help minimize the performance impact of gathering all these hardware stats.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services