Skip to content

Commit d6df6cd

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/master'
Merging duplicate fixes for the same issue nvmlabs/statsd-influxdb-backend@1c7effa cce20b6 Conflicts: lib/influxdb.js
2 parents 73c0d09 + af7e19d commit d6df6cd

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

CHANGELOG.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
StatsD InfluxDB backend - CHANGELOG
22
-----------------------------------
33

4+
## v0.4.1 (2015-02-23)
5+
6+
* Use prefixStats setting instead of hardcoding prefix. (#6)
7+
48
## v0.4.0 (2015-02-22)
59

6-
* Add configuration option to enable sending internal statsd metrics.
7-
* Add SET support.
8-
* Fix problem with histograms breaking data flushes.
9-
* Add SSL support.
10+
* Add configuration option to enable sending internal statsd metrics. (#6)
11+
* Add SET support. (#7)
12+
* Fix problem with histograms breaking data flushes. (#8)
13+
* Add SSL support. (#3)
1014
* Improve configuration example in README.
1115

1216
## v0.3.0 (2014-08-24)

lib/influxdb.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ function InfluxdbBackend(startupTime, config, events) {
4949
self.defaultProxyEnable = false;
5050
self.defaultProxySuffix = 'raw';
5151
self.defaultProxyFlushInterval = 1000;
52-
self.prefixStats = config.prefixStats !== undefined ? config.prefixStats : "statsd";
5352

5453
self.host = self.defaultHost;
5554
self.port = self.defaultPort;
@@ -61,6 +60,9 @@ function InfluxdbBackend(startupTime, config, events) {
6160
self.includeStatsdMetrics = false;
6261
self.includeInfluxdbMetrics = false;
6362

63+
/* XXX Hardcoding default prefix here because it is not accessible otherwise. */
64+
self.prefixStats = config.prefixStats !== undefined ? config.prefixStats : 'statsd';
65+
6466
if (config.influxdb) {
6567
self.host = config.influxdb.host || self.defaultHost;
6668
self.port = config.influxdb.port || self.defaultPort;
@@ -154,7 +156,6 @@ InfluxdbBackend.prototype.processFlush = function (timestamp, metrics) {
154156
gauges = metrics.gauges,
155157
timerData = metrics.timer_data,
156158
statsdMetrics = metrics.statsd_metrics,
157-
statsdMetricsRegExp = new RegExp('^'+self.prefixStats),
158159
points = [],
159160
sets = function (vals) {
160161
var ret = {};
@@ -164,14 +165,15 @@ InfluxdbBackend.prototype.processFlush = function (timestamp, metrics) {
164165
return ret;
165166
}(metrics.sets),
166167
startTime = process.hrtime(),
167-
key, timerKey;
168+
key, timerKey,
169+
statsPrefixRegexp = new RegExp('^' + self.prefixStats + '\\.');
168170

169171
/* Convert timestamp from seconds to milliseconds. */
170172
timestamp = (timestamp * 1000);
171173

172174
for (key in counters) {
173175
/* Do not include statsd counters. */
174-
if (!self.includeStatsdMetrics && key.match(statsdMetricsRegExp)) { continue; }
176+
if (!self.includeStatsdMetrics && key.match(statsPrefixRegexp)) { continue; }
175177

176178
var value = counters[key],
177179
k = key + '.counter';
@@ -383,7 +385,7 @@ InfluxdbBackend.prototype.httpPOST = function (points) {
383385
if (!points.length) { return; }
384386

385387
var self = this,
386-
query = {u: self.user, p: self.pass, time_precision: 'm'},
388+
query = {u: self.user, p: self.pass, time_precision: 'ms'},
387389
protocolName = self.protocol == http ? 'HTTP' : 'HTTPS',
388390
startTime;
389391

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "statsd-influxdb-backend",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "InfluxDB backend for StatsD",
55
"main": "lib/influxdb.js",
66
"dependencies": {

0 commit comments

Comments
 (0)