Comparing version 4.3.1 to 4.4.0
@@ -8,2 +8,5 @@ CHANGELOG | ||
## 4.4.0 (2017-3-23) | ||
* @RijulB Global sample rate | ||
## 4.3.1 (2016-11-7) | ||
@@ -10,0 +13,0 @@ * @RandomSeeded Fix callbacks not being triggered when using buffers |
@@ -21,6 +21,7 @@ "use strict"; | ||
* @bufferFlushInterval {Number} the time out value to flush out buffer if not | ||
* @option sampleRate {Float} Global Sampling rate, default: 1 (No sampling) | ||
* @constructor | ||
*/ | ||
var Client = function (host, port, prefix, suffix, globalize, cacheDns, mock, | ||
globalTags, maxBufferSize, bufferFlushInterval, telegraf) { | ||
globalTags, maxBufferSize, bufferFlushInterval, telegraf, sampleRate) { | ||
var options = host || {}, | ||
@@ -41,3 +42,4 @@ self = this; | ||
bufferFlushInterval: bufferFlushInterval, | ||
telegraf : telegraf | ||
telegraf : telegraf, | ||
sampleRate : sampleRate | ||
}; | ||
@@ -55,2 +57,3 @@ } | ||
this.maxBufferSize = options.maxBufferSize || 0; | ||
this.sampleRate = options.sampleRate || 1; | ||
this.bufferFlushInterval = options.bufferFlushInterval || 1000; | ||
@@ -78,3 +81,3 @@ this.bufferHolder = options.isChild ? options.bufferHolder : { buffer: "" }; | ||
} | ||
if (!options.isChild && options.errorHandler) { | ||
@@ -383,2 +386,3 @@ this.socket.on('error', options.errorHandler); | ||
sampleRate = sampleRate || this.sampleRate; | ||
if(sampleRate && sampleRate < 1){ | ||
@@ -385,0 +389,0 @@ if(Math.random() < sampleRate){ |
{ | ||
"name": "hot-shots", | ||
"description": "Node.js client for StatsD, DogStatsD, and Telegraf", | ||
"version": "4.3.1", | ||
"version": "4.4.0", | ||
"author": "Steve Ivy", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -15,2 +15,11 @@ # hot-shots | ||
## Migrating from node-statsd | ||
You generally just need to do two things: | ||
1. Change node-statsd to hot-shots in all requires | ||
2. Change global_stats to globalStats as a parameter name | ||
You may also want to use the Datadog events support in here instead of other libraries. You can also check the detailed [change log](https://github.com/brightcove/hot-shots/blob/master/CHANGES.md) for what has changed since the last release of node-statsd. | ||
## Usage | ||
@@ -32,2 +41,3 @@ | ||
* `telegraf`: Use Telegraf's StatsD line protocol, which is slightly different than the rest `default: false` | ||
* `sampleRate`: Sends only a sample of data to StatsD for all StatsD methods. Can be overriden at the method level. `default: 1` | ||
* `errorHandler`: A function with one argument. It is called to handle various errors. `default: none`, errors are thrown/logger to console | ||
@@ -34,0 +44,0 @@ |
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
35075
7
579
219