Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bunyan-influxdb

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bunyan-influxdb - npm Package Compare versions

Comparing version 0.1.1 to 0.2.1

61

lib/influx.js
'use strict';
var stream = require('stream');
var util = require('util');
var stream = require('stream');
var util = require('util');
var Writable = stream.Writable;
var influx = require('influx');
var async = require('async');
var influx = require('influx');
var cargo = require('async-timed-cargo');
var async = require('async');

@@ -12,3 +13,21 @@

this.options = options || {};
this.clientInflux = influx(options.influx);
this.clientInflux = influx(options.influx);
this.cargo = cargo(function (tasks, callback) {
var points = tasks.map(function (t) {
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);
}.bind(this));
}.bind(this), function (err, result) {
callback(err, result);
}.bind(this));
}.bind(this), 500, 1000);
}

@@ -20,10 +39,9 @@

InfluxDBStream.prototype.write = function( chunk ) {
InfluxDBStream.prototype.write = function (chunk) {
chunk = chunk || {};
if( !this.options.transform ) {
if (!this.options.transform) {
return;
}
var transformed = this.options.transform(chunk);
if( !transformed || transformed.length < 3 ) {
if (!transformed || transformed.length < 3) {
return;

@@ -37,12 +55,9 @@ }

async.retry({times: 3, interval: 3000}, function( clbk, results ){
//console.log( "Write Point ", series, point, tags, time );
this.clientInflux.writePoint( series, point, tags, time, function(err) {
if(err) {
console.error( "Influxdb write error ", err );
}
clbk && clbk( err );
}.bind(this));
}.bind(this), function(err, result) {
}.bind(this));
this.cargo.push({
series: series,
points: [{value: point, time: time}, tags]
}, function (err) {
//console.log('');
}
);

@@ -53,7 +68,7 @@ };

module.exports = function (options) {
if (!options) {
options = {};
}
return new InfluxDBStream(options);
if (!options) {
options = {};
}
return new InfluxDBStream(options);
};
{
"name": "bunyan-influxdb",
"version": "0.1.1",
"version": "0.2.1",
"description": "Bunyan InfluxDB Stream",

@@ -13,4 +13,5 @@ "main": "index.js",

"async": "^1.5.0",
"async-timed-cargo": "0.0.3",
"influx": "^4.0.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc