rails/rails — pull request #11842 by dasch (2013-08-11 12:34:51+00:00)
Title: Improve Active Record instrumentation

I've implemented some monitoring of an app using AS::Notifications, but the instrumentation of Active Record is somewhat rudimentary.

This pull request adds the SQL "operation" to the event payloads (I'm not 100% sure that's the best name.) For instance, a `SELECT` query will emit an event with a payload including `:operation => :select`. Only `SELECT`, `INSERT`, `UPDATE`, and `DELETE` are supported.

Furthermore, the ExplainSubscriber has been updated to take advantage of this new payload so it doesn't have to parse the query itself.

The actual parsing of the SQL could definitely be more efficient – if you want I can optimize it.