Permalink
Browse files

Fixes for metrics workflow.

  • Loading branch information...
1 parent b588496 commit a144f6b3a3d7aa9a442193aef4fa54a75004bb41 @mde mde committed Feb 8, 2012
Showing with 19 additions and 8 deletions.
  1. +1 −0 Jakefile
  2. +2 −0 lib/base_config.js
  3. +11 −8 lib/cluster/master.js
  4. +5 −0 templates/base/environment.js
View
@@ -58,6 +58,7 @@ namespace('gen', function () {
, 'mkdir -p ./' + dir + '/app/controllers'
, 'mkdir -p ./' + dir + '/lib'
, 'mkdir -p ./' + dir + '/log'
+ , 'mkdir -p ./' + dir + '/node_modules'
, 'cp -r ' + templateDir + '/views ' + dir + '/app/'
, 'cp -r ' + templateDir + '/public ' + dir
, 'cp ' + templateDir + '/router.js ' + dir + '/config/'
View
@@ -33,6 +33,8 @@
}
// Key for when using Cookie session-store
, cookieSessionKey: 'sdata'
+// Should be an object literal with config opts if used
+, metrics: null
};
module.exports = config;
View
@@ -136,15 +136,18 @@ Master.prototype = new (function () {
rotateAndInitByType();
}
, _startMetrics = function (next) {
- var self = this;
- if (self.config.metrics) {
+ var metrics
+ , port;
+ if (this.config.metrics) {
try {
- var metrics = require(process.cwd() + '/node_modules/metrics')
- , port = self.config.metrics.port || 9091;
- self.stdoutLog.info("Metrics server started on port " + port);
- self.metricsServer = new metrics.Server(port);
- } catch(e) {
- throw e;//new Error("To turn on Metrics, do `npm install metrics`. Couldn't find it at: " + process.cwd() + "/node_modules/metrics");
+ port = this.config.metrics.port;
+ metrics = require(process.cwd() + '/node_modules/metrics');
+ this.stdoutLog.info("Metrics server started on port " + port);
+ this.metricsServer = new metrics.Server(port);
+ }
+ catch(e) {
+ throw new Error("To turn on Metrics, do `npm install metrics`. " +
+ "Couldn't find it at: " + process.cwd() + "/node_modules/metrics");
}
}
next();
@@ -1,4 +1,9 @@
var config = {
+ /*
+ metrics: {
+ port: 4001
+ }
+ */
};
module.exports = config;

0 comments on commit a144f6b

Please sign in to comment.