metrics-client
v0.1.1
Published
Metrics Client to send metrics to Telegraf via different protocols with configuratable bufferring feature
Downloads
15,439
Readme
metrics-client-node
Metrics Client to send metrics to Telegraf via different protocols with configurable buffering feature
Install
Install with
npm install metrics-client --save
Usage
To get started, initialize a new instance with protocol.
const MetricsClient = require('metrics-client')
var client = new MetricsClient({
handler: 'telegrafHttpHandler',
host: 'localhost',
port: 8186,
database: 'test',
maxBufferSize: 0
})
To send message(s)
client.send(message)
We accept one message or a list of messages, which needs to have a format of
{
measure: 'measure-name',
fields: { field1: 123, field2: 'someOtherValse' },
tags: { tag1: 'tag1', tag2: 'tag2'}
}
To close the client
client.close()
Limitation
We only have 2 handler implementations: telegrafHttpHandler and telegrafUdpHandler. User can provide the implementation of its own handler implementation.
var handler = function(options) {
return (messages) => {
// implementation here
}
}