metrics-client

0.1.1 • Public • Published

metrics-client-node

Build StatusCoverage StatusStandard - JavaScript Style Guide

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
    }
}

Readme

Keywords

none

Package Sidebar

Install

npm i metrics-client

Weekly Downloads

3,319

Version

0.1.1

License

Apache-2.0

Last publish

Collaborators

  • tmwllc
  • yunwang240