bunyan-influxdb
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -15,18 +15,23 @@ 'use strict'; | ||
this.cargo = cargo(function (tasks, callback) { | ||
var points = tasks.map(function (t) { | ||
var dbs = {}; | ||
tasks.map(function (t) { | ||
dbs[t.db] = dbs[t.db] || []; | ||
dbs[t.db] = dbs[t.db].concat(t.points); | ||
return t.points; | ||
}); | ||
async.retry({ | ||
times: this.options.tries || 1, | ||
interval: this.options.tryInterval || 3000 | ||
}, function (clbk, results) { | ||
this.clientInflux.writePoints(tasks[0].series, points, function (err) { | ||
if (err) { | ||
console.error("Influxdb write error ", err); | ||
} | ||
clbk && clbk(err); | ||
for(var k in dbs) { | ||
async.retry({ | ||
times: this.options.tries || 1, | ||
interval: this.options.tryInterval || 3000 | ||
}, function (clbk, results) { | ||
this.clientInflux.writePoints(tasks[0].series, dbs[k], k, function (err) { | ||
if (err) { | ||
console.error("Influxdb write error ", err); | ||
} | ||
clbk && clbk(err); | ||
}.bind(this)); | ||
}.bind(this), function (err, result) { | ||
callback(err, result); | ||
}.bind(this)); | ||
}.bind(this), function (err, result) { | ||
callback(err, result); | ||
}.bind(this)); | ||
} | ||
}.bind(this), 500, 1000); | ||
@@ -54,10 +59,17 @@ } | ||
this.cargo.push({ | ||
series: series, | ||
points: [{value: point, time: time}, tags] | ||
}, function (err) { | ||
//console.log(''); | ||
} | ||
); | ||
var cargoItem = { | ||
series: series, | ||
db: this.options.influx.database, | ||
points: [{value: point, time: time}, tags] | ||
}; | ||
if(tags && tags.appId) { | ||
cargoItem.db = tags.appId; | ||
delete tags.appId; | ||
} | ||
this.cargo.push(cargoItem, function (err) { | ||
console.error('bunyan-influxdb ', err); | ||
}); | ||
}; | ||
@@ -71,3 +83,2 @@ | ||
return new InfluxDBStream(options); | ||
}; | ||
}; |
{ | ||
"name": "bunyan-influxdb", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Bunyan InfluxDB Stream", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
3646
67