Wednesday, October 2, 2013

Statsd

During the last couple of days, I was trying to find myself around Statsd from Etsy. It seems to be a wonderful tool which lets users send stats (or tracking) to a server which in turn could be visualized using tools like Graphite.

The set up is quite simple. Add the Statsd gem to your application's Gemfile and then write a Rack Middleware which sends out information to the predefined server. Before sending out information, we need to setup the Statsd NodeJS Server and give the IP and port for the Gem to work.

Matt Aimonetti has written a great post about setting up the service.

I have found it damn hard to set up Graphite.

The download is easy. git clone the 3 repositories and then run check_dependencies.

Install all the required libraries using pip. Now comes the hard part. A 2D graphics library called Cairo is a dependency for Graphite and a library called py2cairo (pycairo if python >2.7) is to be installed.

I would suggest installing cairo using

sudo brew install cairo

Homebrew is better than MacPorts.

Install pycairo using pip

sudo pip install pycairo

Or

easy_install pycairo

You might get errors when importing the module for cairo. This might be because you installed it via easy_install.

If it does not work (it did not because I have 2 versions of python), symlink from the site-packages/Cairo to the place where python searches for site-packages.

Then run check_dependencies again and you are good to go. I still have to setup Graphite. But I hope I'll have less obstacles after this.

No comments: