Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
WANG, Yun authored and WANG, Yun committed Jan 19, 2017
1 parent 84521cf commit 725c986
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,40 @@ Install with
```
npm install git+https://github.com/Nordstrom/metrics-client-node.git --save
```

### Usage
To get started, initialize a new instance with protocol.
```js
const MetricsClient = require('metrics-client-node')
var client = new MetricsClient({
protocol: 'udp',
host: 'localhost',
port: 8092
})
```
Or to enable buffer
```js
const MetricsClient = require('metrics-client-node')
var client = new MetricsClient({
protocol: 'http',
bufferEnabled: true,
host: metrics.lambda.uri,
port: +metrics.lambda.port,
database: metrics.influxdb,
maxBufferSize: +metrics.bufferSize,
flushInterval: +metrics.flushInterval
})
```

This comment has been minimized.

Copy link
@andyday

andyday Jan 24, 2017

it seems like this is not a generic metrics client but a buffered telegraf client -- maybe call it buffered-telegraf-node instead. Also I would change the above to

const Telegraf = require('buffered-telegraf-node')
const telegraf = new Telegraf({
    uri: 'udp://my.telegraf-server.net:8092',
    maxBufferSize: 1024
})

maxBufferSize = 0 or -1 would turn off buffering which is what the buffered messenger does currently. protocol, url, and port would be parsed from uri using https://nodejs.org/api/url.html#url_url_parse_urlstring_parsequerystring_slashesdenotehost

This comment has been minimized.

Copy link
@yunwang240

yunwang240 Jan 25, 2017

Contributor

Add the 'turning off' buffer in buffered-messenger-node module.
Also changed README

To send message(s)
```js
client.send(message)
```

To close the client
```js
client.close()
```

### Limitation
We only support 2 protocols: http and udp; and udp is only default protocol.

0 comments on commit 725c986

Please sign in to comment.