remove last_ prefix to avoid admin 'stats' match

This commit is contained in:
Dan Rowe 2012-12-12 08:09:25 -05:00
Родитель fa0b5cf086
Коммит f9e591bcf5
2 изменённых файлов: 12 добавлений и 8 удалений

Просмотреть файл

@ -215,6 +215,8 @@ Graphite:
flush to graphite
* graphite.last_exception: the number of seconds elapsed since the last
exception thrown whilst flushing to graphite
* graphite.flush_length: the length of the string sent to graphite
* graphite.flush_time: the time it took to send the data to graphite
A simple nagios check can be found in the utils/ directory that can be used to
check metric thresholds, for example the number of seconds since the last

Просмотреть файл

@ -41,8 +41,8 @@ var graphiteStats = {};
var post_stats = function graphite_post_stats(statString) {
var last_flush = graphiteStats.last_flush || 0;
var last_exception = graphiteStats.last_exception || 0;
var last_flush_time = graphiteStats.last_flush_time || 0;
var last_flush_length = graphiteStats.last_flush_length || 0;
var flush_time = graphiteStats.flush_time || 0;
var flush_length = graphiteStats.flush_length || 0;
if (graphiteHost) {
try {
var graphite = net.createConnection(graphitePort, graphiteHost);
@ -55,16 +55,16 @@ var post_stats = function graphite_post_stats(statString) {
var ts = Math.round(new Date().getTime() / 1000);
var ts_suffix = ' ' + ts + "\n";
var namespace = globalNamespace.concat('statsd');
statString += namespace.join(".") + '.graphiteStats.last_exception ' + last_exception + ts_suffix;
statString += namespace.join(".") + '.graphiteStats.last_flush ' + last_flush + ts_suffix;
statString += namespace.join(".") + '.graphiteStats.last_flush_time ' + last_flush_time + ts_suffix;
statString += namespace.join(".") + '.graphiteStats.last_flush_length ' + last_flush_length + ts_suffix;
statString += namespace.join(".") + '.graphiteStats.last_exception ' + last_exception + ts_suffix;
statString += namespace.join(".") + '.graphiteStats.last_flush ' + last_flush + ts_suffix;
statString += namespace.join(".") + '.graphiteStats.flush_time ' + flush_time + ts_suffix;
statString += namespace.join(".") + '.graphiteStats.flush_length ' + flush_length + ts_suffix;
var starttime = Date.now();
this.write(statString);
this.end();
graphiteStats.last_flush_time = (Date.now() - starttime);
graphiteStats.flush_time = (Date.now() - starttime);
graphiteStats.flush_length = statString.length;
graphiteStats.last_flush = Math.round(new Date().getTime() / 1000);
graphiteStats.last_flush_length = statString.length;
});
} catch(e){
if (debug) {
@ -207,6 +207,8 @@ exports.init = function graphite_init(startup_time, config, events) {
graphiteStats.last_flush = startup_time;
graphiteStats.last_exception = startup_time;
graphiteStats.flush_time = 0;
graphiteStats.flush_length = 0;
flushInterval = config.flushInterval;