npm.io
0.1.0 • Published 10 years ago

tstatsd

Licence
ISC
Version
0.1.0
Deps
0
Vulns
0
Weekly
0
Stars
1

node-telegraf-statsd

Abbr: tstatsd means t(telegraf)statsd Generate telegraf statsd's inputs in NodeJs

Usage

Install

npm install tstatsd --save

Example

const Tstatsd = require('tstatsd');
let tstatsd = new Tstatsd('10.211.55.18');
tstatsd.timing('tstatsd.test.timing', 10);

Api

Kind: global class

new Tstatsd(host, port)
Param Type Description
host String 主机IP
port Integer 服务端口

tstatsd.gauge(key, value, operator)

gauge

Kind: instance method of Tstatsd

Param Type Description
key String
value Integer
operator Enum 操作符,可选 ['+', '-']

tstatsd.counter(key, step, sample)

counter

Kind: instance method of Tstatsd

Param Type Description
key String
step Integer 步进
sample Float 采样率,最后增量为 step/sample

tstatsd.set(key, value)

set

Kind: instance method of Tstatsd

Param Type Description
key String
value String 遇到不同值才会加一

tstatsd.timing(key, value, unit, sample)

Kind: instance method of Tstatsd

Param Type Description
key String
value Integer 消耗时长
unit Enum 计时单位, ms/h
sample Float 采样率,最后 counter=1/sample

tstatsd.send(str)

原生发送方法

Kind: instance method of Tstatsd

Param Type Description
str String statsd 定义的字符串

Keywords