-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
yunwang240
Contributor
|
||
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. |
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
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