Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: b941425602
Fetching contributors…

Cannot retrieve contributors at this time

33 lines (21 sloc) 0.821 kb

kruxstatsd

kruxstatsd is a wrapper library around pystatsd. It will format stats based on a provided prefix (just like pystatsd), environment, and the host the client is running on. For example, incrementing the following stat on a host called ops-dev004.krxd.net:

import kruxstatsd

k = kruxstatsd.StatsClient('js', env='stage')
k.incr('foo')

will create a counter stat named 'stage.js.foo.ops-dev004'.

Similarly, the following:

k.timing('foo', 'TIME')

will create a timer stat named 'stage.js.foo.ops-dev004'.

Usage

To use kruxstatsd, simply import it instead of pystatsd. The interface is exactly the same. Context managers will also continue to work:

with k.timer('expensive_op'):
    func()
Jump to Line
Something went wrong with that request. Please try again.