1.1.5 • Published 10 years ago

graphite-service v1.1.5

Weekly downloads
1
License
ISC
Repository
github
Last release
10 years ago

graphite-services

Graphite UDP client for Node.js

Install

npm install graphite-service

Usage

var Graphite = require('graphite-service')
var metric = new Graphite([options])
metric.add(name, value, type)

options is an object with the following defaults:

{
  host: 'localhost', // graphite server host or ip
  port: 8081, // graphite server udp port
  type: 'udp4', // udp type (udp4 or udp6)
  prefix: '', // a prefix to prepend to the name of all metrics
  suffix: '', // a suffix to append to the name of all metrics
  interval: 5000, // group metrics for 5s and send only 1 request
  allow: {
  		production: true,
  		development: false
  }
}

Example

var Graphite = require('graphite-service')
var metric = new Graphite({
  prefix: 'app',
  interval: 10000
})

metric.add('user', 1, 'c') // add 1

Will generate

app.user 1 1447192345

API

metric.instance

add new instance graphite-service

var userMetric = metric.instance();
userMetric.add('metric', 1, 'c');

metric.start & metric.end

add time metric

var userMetric = metric.instance();
userMetric.start('metric');
....
userMetric.end('metric');

Will generate

app.metric:time|s;

metric.add

During the interval time option, if 2 or more metrics with the same name are sent, metrics will be added (summed)

metric.add('metric', 1)

Will generate

app.metric 1 1447192345;

License

Licensed under the MIT license.

1.1.5

10 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.0

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago