etsy/statsd — pull request #152 by VivienBarousse (2012-09-04 16:46:51+00:00)
Title: Add support for sets, countings unique events

Those commits add support for sets as a new type of buckets.

Sets are acting like simple counters, with the additional specificity that it ignores duplicate values.

Technically, all values are stored in a set, and the number of elements in the set is sent to graphite during flushes. Sets are also emptied during flushes (in the same way that counters are reset to 0).

We have been using it in production for a while now, and it is working as expected. The use case that was used during the development of that feature was the following (it has been since extended to other cases as well):
- We want to graph the number of active logged in users on the website.
- Maintaining that state across application servers to manually update gauges is non-trivial.
- We send a message to statsd containing the id of the user making a request.
- statsd store all unique values between flushes, and sends the number of elements in the set to graphite.

I hope this fits in the project and is not too specific to our use.