Git Product home page Git Product logo

dog-statsy's Introduction

dog-statsy Circle CI

A dogstatsd client.

Installation

$ npm install dog-statsy

Example

const Client = require('dog-statsy')
const http = require('http')
const stats = new Client({})

setInterval(function(){
  const start = new Date
  http.get('http://yahoo.com', function(err, res){
    const ms = new Date - start
    stats.histogram('request.duration', ms, ['request:yahoo'])
  })
}, 1000)

API

Client([opts])

Initialize a client with the given options:

  • host [localhost]
  • port [8125]
  • prefix optional prefix ('.' is appended)
  • tags array of tags to include in every call
  • bufferSize optional buffer size, if not defined, it will send the data immediately
  • flushInterval optional, only valid when bufferSize is defined. It will flush the buffer after the interval in miliseconds (if not empty)

.gauge(name, val, [tags])

Send gauge value.

.meter(name, val, [tags])

Send meter value.

.set(name, val, [tags])

Send set value.

.count(name, val, [tags])

Send count value.

.incr(name, [val], [tags])

Increment by val or 1.

.decr(name, [val], [tags])

Decrement by val or 1.

.histogram(name, val, [tags])

Send histogram value.

.histogram(name)

Return histogram delta function.

.timer(name, val, [tags])

Send timer value.

.timer(name)

Return timer delta function.

.trace(name, [tags])

Return a trace object.

Trace

.step(name, [tags])

Adds a step to a trace.

.complete()

Completes a trace.

License

MIT

dog-statsy's People

Contributors

calvinfo avatar achille-roussel avatar yields avatar carlosmecha avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.