Comparing version 2.0.0 to 2.1.0
@@ -9,11 +9,15 @@ CHANGELOG | ||
## 2.1.0 (2015-12-9) | ||
* @mmoulton Add options.telegraf to enable support for Telegraf's StatsD line protocol format | ||
* @mmoulton Ensure message callback is sent in buffered case, even when we just buffer. | ||
## 2.0.0 (2015-10-22) | ||
* Add options.maxBufferSize and optinons.bufferFlushInterval | ||
* Change options.global_tags to options.globalTags for conistency | ||
* @jjofseattle Add options.maxBufferSize and optinons.bufferFlushInterval | ||
* @bdeitte Change options.global_tags to options.globalTags for conistency | ||
## 1.0.2 (2015-09-25) | ||
* Thrown error when cacheDNS flag fails to resolve DNS name | ||
* @ainsleyc Thrown error when cacheDNS flag fails to resolve DNS name | ||
## 1.0.1 (2015-09-24) | ||
* Add the event API used by DogStatsD | ||
* Start from the base of https://github.com/sivy/node-statsd | ||
* @bdeitte Add the event API used by DogStatsD | ||
* @sivy Start from the base of https://github.com/sivy/node-statsd |
@@ -19,3 +19,3 @@ var dgram = require('dgram'), | ||
*/ | ||
var Client = function (host, port, prefix, suffix, globalize, cacheDns, mock, globalTags, maxBufferSize, bufferFlushInterval) { | ||
var Client = function (host, port, prefix, suffix, globalize, cacheDns, mock, globalTags, maxBufferSize, bufferFlushInterval, telegraf) { | ||
var options = host || {}, | ||
@@ -33,5 +33,6 @@ self = this; | ||
mock : mock === true, | ||
globalTags : globalTags, | ||
globalTags : globalTags, | ||
maxBufferSize : maxBufferSize, | ||
bufferFlushInterval: bufferFlushInterval | ||
bufferFlushInterval: bufferFlushInterval, | ||
telegraf : telegraf, | ||
}; | ||
@@ -46,3 +47,4 @@ } | ||
this.mock = options.mock; | ||
this.globalTags = options.globalTags || []; | ||
this.globalTags = options.globalTags || []; | ||
this.telegraf = options.telegraf || false; | ||
this.maxBufferSize = options.maxBufferSize || 0; | ||
@@ -160,2 +162,6 @@ this.bufferFlushInterval = options.bufferFlushInterval || 1000; | ||
Client.prototype.event = function(title, text, options, tags, callback) { | ||
if (this.telegraf) { | ||
throw new Error('Not supported by Telegraf / InfluxDB'); | ||
} | ||
var message, | ||
@@ -273,3 +279,3 @@ msgTitle = title ? title : '', | ||
//don't want to send if we don't meet the sample ratio | ||
return; | ||
return callback(); | ||
} | ||
@@ -297,3 +303,8 @@ } | ||
if(mergedTags.length > 0){ | ||
message += '|#' + mergedTags.join(','); | ||
if (this.telegraf) { | ||
message = message.split(':'); | ||
message = message[0] + ',' + mergedTags.join(',').replace(':', '=') + ':' + message.slice(1).join(':'); | ||
} else { | ||
message += '|#' + mergedTags.join(','); | ||
} | ||
} | ||
@@ -369,2 +380,1 @@ | ||
exports.StatsD = Client; | ||
{ | ||
"name": "hot-shots", | ||
"description": "Node.js client for statsd and DogStatsD", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"author": "Steve Ivy", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
# hot-shots | ||
A Node.js client for [Etsy](http://etsy.com)'s [StatsD](https://github.com/etsy/statsd) server and | ||
Datadog's [DogStatsD](http://docs.datadoghq.com/guides/dogstatsd/) server. | ||
A Node.js client for [Etsy](http://etsy.com)'s [StatsD](https://github.com/etsy/statsd) server that supports both Datadog's [DogStatsD](http://docs.datadoghq.com/guides/dogstatsd/) and [InfluxDB's](http://influxdb.com) [Telegraf](https://github.com/influxdb/telegraf) StatsD server. | ||
@@ -31,2 +30,3 @@ This project is a fork off of [node-statsd](https://github.com/sivy/node-statsd) | ||
* `bufferFlushInterval`: If buffering is in use, this is the time in ms to always flush any buffered metrics. `default: 1000` | ||
* `telegraf`: Use Telegraf's StatsD line protocol `default: false` | ||
@@ -69,3 +69,3 @@ All StatsD methods other than event have the same API: | ||
// Histogram: send data for histogram stat | ||
// Histogram: send data for histogram stat (DataDog and Telegraf only) | ||
client.histogram('my_histogram', 42); | ||
@@ -80,3 +80,3 @@ | ||
// Event: sends the titled event | ||
// Event: sends the titled event (DataDog only) | ||
client.event('my_title', 'description'); | ||
@@ -90,3 +90,3 @@ | ||
// Tags, this will add user-defined tags to the data | ||
// Tags, this will add user-defined tags to the data (DataDog and Telegraf only) | ||
client.histogram('my_histogram', 42, ['foo', 'bar']); | ||
@@ -104,3 +104,3 @@ | ||
// Sampling, tags and callback are optional and could be used in any combination | ||
// Sampling, tags and callback are optional and could be used in any combination (DataDog and Telegraf only) | ||
client.histogram('my_histogram', 42, 0.25); // 25% Sample Rate | ||
@@ -115,8 +115,12 @@ client.histogram('my_histogram', 42, ['tag']); // User-defined tag | ||
## DogStatsD-specific usage | ||
## DogStatsD and Telegraf functionality | ||
Some of the functionality mentioned above is specific to DogStatsD and will not do anything if are using the regular statsd client. This includes: | ||
* global_tags parameter | ||
Some of the functionality mentioned above is specific to DogStatsD or Telegraf. They will not do anything if you are using the regular statsd client. | ||
* globalTags parameter | ||
* tags parameter | ||
* histogram method | ||
## DogStatsD functionality | ||
Some of the functionality mentioned above is specific to DogStatsD. They will not do anything if you are using the regular statsd client or Telegraf. | ||
* event method | ||
@@ -141,3 +145,3 @@ | ||
1. Make sure you've added any new tests needed | ||
2. Run "npm install && npm unit" | ||
2. Run "npm install && npm test" | ||
3. Update the HEAD section in CHANGES.md with a description of what you have done | ||
@@ -157,2 +161,1 @@ 4. Push your changes and create the PR, and we'll try to get this merged in right away | ||
hot-shots is licensed under the MIT license. | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28413
10
354
154