mozilla/openbadges — pull request #795 by cmcavoy (2013-03-24 13:57:13+00:00)
Title: [do-not-merge] 793 add statsd

@brianloveswords looking for some advice on where to integrate statsd counters. I tried a couple of different ways,

1) adding calls as middleware on urls like "add a badge". My first try, I like this - except I couldn't actually get it to work.
2) adding it directly to the badge add controller. Not my favorite, because it grosses up the controller code.
3) adding it to the badge model. meh.
4) adding it to the mysql lib wrapper. I like this because it gets us nice stats with minimal code, but couples things too tightly imo.
5) having the mysql lib wrapper emit events that we listen for and fire off statsd. This is my favorite idea, but I don't understand the scope of emitted events. My simple test of the idea doesn't work.

I really like the idea of key events emitting, and statsd just being a consumer of emitted events. That feels the most clean to me, keep the actual functioning of the app separate from the metrics around the app. I don't know if it can actually work...can you fire global events?