node-tsguru
TimeSeries.Guru Node.js client.
Installation
npm install node-tsguru
Demos
Demo applications are available at:
Usage
Callback style
Create client
var tsguru = ;;
Insert single value (simple time series with one column)
client;
Insert single value (simple time series with two columns)
client;
Insert single value (symbol time series with one column)
client;
Insert single value (symbol time series with three columns)
client;
Insert multiple values
client ;
Buffer values
var buffer = client;buffer;buffer;;
buffer()
returns an [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
. Emitted events are error
, flush
and flushed
.
Promise style
Create client
var tsguru = ; ;
Insert single value
client ;
Insert multiple values
client ;
API
(params[, cb])
params
: Objecttoken
: StringdatabaseID
: Stringtimeout
: Number in milliseconds (optional, default: 10000)
cb
: Function(err, client) (optional)err
: Error or undefinedclient
: Client or undefined
returns a Promise if no cb
was supplied
Client
Client
is an [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter)
.
insert(timeseriesName, value1[, value2[, ...]][, cb])
Insert into a simple time series.
timeseriesName
: Stringvalue1
...valueN
: Number, Boolean or Stringcb
: Function(err) (optional)err
: Error or undefined
returns a Promise if no cb
was supplied
insertSymbol(timeseriesName, symbol, value1[, value2[, ...]][, cb])
Insert into a symbol time series.
timeseriesName
: Stringsymbol
: Stringvalue1
...valueN
: Number, Boolean or Stringcb
: Function(err) (optional)err
: Error or undefined
returns a Promise if no cb
was supplied
bulk()
returns a Bulk
Bulk
add(timeseriesName, value1[, value2[, ...]])
Add to a simple time series.
timeseriesName
: Stringvalue1
...valueN
: Number, Boolean or String
addSymbol(timeseriesName, symbol, value1[, value2[, ...]])
Add to a symbol time series.
timeseriesName
: Stringsymbol
: Stringvalue1
...valueN
: Number, Boolean or String
insert([cb])
Insert takes care about maximal allowed body size. A single insert can be split into multiple POST calls if the HTTP body gets to large.
cb
: Function(err) (optional)err
: Error or undefined
returns a Promise if no cb
was supplied
buffer(params)
params
: Objectdelay
: Number - delay in milliseconds
returns a Buffer
Buffer
add(timeseriesName, value1[, value2[, ...]])
Add to a simple time series.
timeseriesName
: Stringvalue1
...valueN
: Number, Boolean or String
addSymbol(timeseriesName, symbol, value1[, value2[, ...]])
Add to a symbol time series.
timeseriesName
: Stringsymbol
: Stringvalue1
...valueN
: Number, Boolean or String
close([cb])
Flush the buffer and stop the interval timer. No more adds after close!
cb
: Function(err) (optional)err
: Error or undefined
returns a Promise if no cb
was supplied