StatsD is a NodeJS daemon, listening for udp message. It parses the message received, get the metrics and then flush it at periodic times. Its the perfect tool for monitoring anything like your own application metrics, without any overheads on your servers or your coders for starting using it.
StatsD benefits on other systems ?
- Super easy on client side: the client just send udp packet with a simple text protocol. No configuration needed, you just have to know the destination ip and port. You have client implementation on ruby, js, python, c etc…
- Super light on client side: udp is fire and forget. On heavy loaded machines, you have a very very low overhead.
- Manage data on server side: keep track of counters for you.
- Trivial api: you deal with counters, timers and gauges. thats it !
- Plug to other system like graphite: statesd don’t graph anything, but it natively supports graphite backend to flush data for graphing. I’ve also implemented a udp proxy backend in node, sending every datas to a eventmachine websocket broker: easy !
- Business / Application ready api: just perfect for tracking db response times, user interactions on frontend, temperature, api response times, login errors / success etc…
Why i use StatsD and Graphite
- i use StatsD because its the lightest solution in term of installation and code integration.
- I use graphite because with graphs like munin we are very far from the real time (1 or 5 minutes) and with graphite we can really customize dashboards: its perfect !
Code examples (client side)
I use statsd-ruby for my application. With this lib, code looks like this.
$statsd = Statsd.new '192.168.0.1', 8125
# using it
$statsd.increment 'visits' $statsd.timing 'response time', 320 $statsd.gauge 'documents.count', 42
Graphite performs two tasks:
- Storing numbers changing over time
- Graphing them
More infos on StatsD
StatsD is develop by the start-up Etsy: here is their blog post about this tool.