Categories
Code Ruby

Ruby-protoc Makefile

Here’s a little Makefile I use with the Rails Pipeline we’re building at Harry’s. It builds .proto ProtocolBuffer definitions into .pb.rb Ruby classes using the ruby-protoc compiler.

To use, you would have ruby-protoc in your Gemfile. Set the GENDIR variable to point at the directory with your .proto files, then run make.

Categories
Code Python

Statsd Admin Interface for Python

Here’s a little python class for interacting with the statsd admin interface. I wrote it for EnergyHub, where we used it alongside the nifty pystatsd module to clean up obsolete stats as we rotated our servers. We can delete the obsolete stats, in order to prevent gauges, for example, from reporting their last value until statsd restarts.

It implements the admin commands to list stats: stats, counters, timers, gauges; and the management commands: delcounters, deltimers, delgauges.