0.1.0 • Published 8 years ago

tstatsd v0.1.0

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

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)

ParamTypeDescription
hostString主机IP
portInteger服务端口

tstatsd.gauge(key, value, operator)

gauge

Kind: instance method of Tstatsd

ParamTypeDescription
keyString
valueInteger
operatorEnum操作符,可选 '+', '-'

tstatsd.counter(key, step, sample)

counter

Kind: instance method of Tstatsd

ParamTypeDescription
keyString
stepInteger步进
sampleFloat采样率,最后增量为 step/sample

tstatsd.set(key, value)

set

Kind: instance method of Tstatsd

ParamTypeDescription
keyString
valueString遇到不同值才会加一

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

Kind: instance method of Tstatsd

ParamTypeDescription
keyString
valueInteger消耗时长
unitEnum计时单位, ms/h
sampleFloat采样率,最后 counter=1/sample

tstatsd.send(str)

原生发送方法

Kind: instance method of Tstatsd

ParamTypeDescription
strStringstatsd 定义的字符串