Stats middleware for Carbon proxy.
Stats collection middleware for Carbon proxy/balancer.
Carbon is middleware based proxy for table or cluster/balanced based routing. It features zero-downtime restart, websocket support, and custom middleware. You can learn more about it at qualiancy/carbon.
Carbon Stats middleware is available for installation from npm.
$ npm install carbon-stats
To get started, create a new carbon proxy and mount the stats middleware before you mount your other carbon middleware, such as a balancer.
var carbon = require'carbon'proxy = carbonlisten8080carbonStats = require'carbon-stats';stats = carbonStatsstore:;proxyusestatsmiddleware;usecarbonbalancer__dirname + '/app.js'workers: 4watch: truehost: 'myapp.com'middleware;
The mark names can be changed so you can segment your statistics:
proxywsstatsmiddlewarerequest: 'ws request'response: 'ws response'missed: 'ws missed';
Stats are available in memory object. Calling the below functions at any time will give you the current stats for that event.
var totalRequests = statsstoremarkTotal'request'totalMisses = statsstoremarkTotal'misses'avgRespTime = statsstorediffAvg'response';
$ make test
Interested in contributing? Fork to get started. Contact @logicalparadox if you are interested in being regular contributor.
- Jake Luer (@logicalparadox)
(The MIT License)
Copyright (c) 2012 Jake Luer firstname.lastname@example.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.