Permalink
Browse files

Fixing up some metrics output. Implemented the new geddy.config.metri…

…cs.namespace config option
  • Loading branch information...
1 parent 4155740 commit e4a3bd7bad088cccbe3e0880f6681e13b11b3d55 Techwraith committed Mar 7, 2012
Showing with 9 additions and 5 deletions.
  1. +2 −3 lib/app.js
  2. +7 −2 lib/metric.js
View
@@ -148,7 +148,6 @@ var App = function () {
, _loadMetrics = function (next) {
if (geddy.config.metrics) {
geddy.metrics = require('./metric');
- geddy.log.notice(geddy.metrics);
}
next();
}
@@ -225,7 +224,7 @@ var App = function () {
// Handle the requests
// ==================
- var allRequestTimer = geddy.config.metrics && new geddy.metrics.Timer('all-requests')
+ var allRequestTimer = geddy.config.metrics && geddy.metrics.Timer('all-requests')
, controllerActionTimers = {};
geddy.server.addListener('request', function (req, resp) {
var reqObj
@@ -323,7 +322,7 @@ var App = function () {
controllerActionTimers[controllerName] = controllerActionTimers[controller] || {}
controllerActionTimers[controllerName][actionName] =
controllerActionTimers[controllerName][actionName] ||
- new geddy.metrics.Timer(controllerName + '.' + actionName)
+ geddy.metrics.Timer(controllerName + '.' + actionName)
controllerActionTimers[controllerName][actionName].update(endTime - accessTime);
}
});
View
@@ -29,19 +29,24 @@ var Metric = function Metrics(messagePasser, eventType, type) {
}
Metric.prototype.newMetric = function(type, eventType) {
+ if (geddy.config.metrics.namespace) {
+ eventType = geddy.config.metrics.namespace + "." + eventType;
+ }
this.messagePasser.sendMessage({
method: 'createMetric'
, type: type
, eventType: eventType
});
}
-Metric.prototype.forwardMessage = function(method, args) {
+Metric.prototype.forwardMessage = function(method, args) {
this.messagePasser.sendMessage({
method: 'updateMetric'
, metricMethod: method
, metricArgs: args
- , eventType: this.eventType
+ , eventType: (geddy.config.metrics.namespace) ?
+ geddy.config.metrics.namespace + "." + this.eventType
+ : this.eventType
});
}

0 comments on commit e4a3bd7

Please sign in to comment.