Skip to content

Commit

Permalink
Adding standalone RPS requests per second stat collector
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Mattozzi committed Jun 27, 2011
1 parent 05be477 commit e6a5c00
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/simpletest.ex.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ nl.run({
'result-codes',
{ name: 'latency', percentiles: [0.9, 0.99] },
'concurrency',
'rps',
'uniques',
{ name: 'http-errors', successCodes: [200,404], log: 'http-errors.log' }
],
Expand Down
9 changes: 9 additions & 0 deletions lib/monitoring/collectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var stats = require('../stats');
var Histogram = stats.Histogram;
var Peak = stats.Peak;
var ResultsCounter = stats.ResultsCounter;
var Rate = stats.Rate;
var Uniques = stats.Uniques;
var Accumulator = stats.Accumulator;
var LogFile = stats.LogFile;
Expand All @@ -41,6 +42,14 @@ StatsCollectors['result-codes'] = function ResultCodesCollector() {
self.end = function(context, http) { self.stats.put(http.res.statusCode); };
};

/** Track requests per second, storing stats in a stats.js#Rate object. The client must call
.end({res: http.ClientResponse}). */
StatsCollectors['rps'] = function RpsCollector() {
var self = this;
self.stats = new Rate();
self.end = function(context, http) { self.stats.put(); };
};

/** Track a status code that is returned in an HTTP header, storing stats in a stats.js#ResultsCounter
object. The client must call .end({res: http.ClientResponse}). */
StatsCollectors['header-code'] = function HeaderCodeCollector(params) {
Expand Down
4 changes: 2 additions & 2 deletions nodeload.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e6a5c00

Please sign in to comment.