@@ -49,7 +49,6 @@ function InfluxdbBackend(startupTime, config, events) {
49
49
self . defaultProxyEnable = false ;
50
50
self . defaultProxySuffix = 'raw' ;
51
51
self . defaultProxyFlushInterval = 1000 ;
52
- self . prefixStats = config . prefixStats !== undefined ? config . prefixStats : "statsd" ;
53
52
54
53
self . host = self . defaultHost ;
55
54
self . port = self . defaultPort ;
@@ -61,6 +60,9 @@ function InfluxdbBackend(startupTime, config, events) {
61
60
self . includeStatsdMetrics = false ;
62
61
self . includeInfluxdbMetrics = false ;
63
62
63
+ /* XXX Hardcoding default prefix here because it is not accessible otherwise. */
64
+ self . prefixStats = config . prefixStats !== undefined ? config . prefixStats : 'statsd' ;
65
+
64
66
if ( config . influxdb ) {
65
67
self . host = config . influxdb . host || self . defaultHost ;
66
68
self . port = config . influxdb . port || self . defaultPort ;
@@ -154,7 +156,6 @@ InfluxdbBackend.prototype.processFlush = function (timestamp, metrics) {
154
156
gauges = metrics . gauges ,
155
157
timerData = metrics . timer_data ,
156
158
statsdMetrics = metrics . statsd_metrics ,
157
- statsdMetricsRegExp = new RegExp ( '^' + self . prefixStats ) ,
158
159
points = [ ] ,
159
160
sets = function ( vals ) {
160
161
var ret = { } ;
@@ -164,14 +165,15 @@ InfluxdbBackend.prototype.processFlush = function (timestamp, metrics) {
164
165
return ret ;
165
166
} ( metrics . sets ) ,
166
167
startTime = process . hrtime ( ) ,
167
- key , timerKey ;
168
+ key , timerKey ,
169
+ statsPrefixRegexp = new RegExp ( '^' + self . prefixStats + '\\.' ) ;
168
170
169
171
/* Convert timestamp from seconds to milliseconds. */
170
172
timestamp = ( timestamp * 1000 ) ;
171
173
172
174
for ( key in counters ) {
173
175
/* Do not include statsd counters. */
174
- if ( ! self . includeStatsdMetrics && key . match ( statsdMetricsRegExp ) ) { continue ; }
176
+ if ( ! self . includeStatsdMetrics && key . match ( statsPrefixRegexp ) ) { continue ; }
175
177
176
178
var value = counters [ key ] ,
177
179
k = key + '.counter' ;
@@ -383,7 +385,7 @@ InfluxdbBackend.prototype.httpPOST = function (points) {
383
385
if ( ! points . length ) { return ; }
384
386
385
387
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 ' } ,
387
389
protocolName = self . protocol == http ? 'HTTP' : 'HTTPS' ,
388
390
startTime ;
389
391
0 commit comments