out of time
-
NewRelic metrics for Mongoid
The rpm_contrib project provides a one-stop shop for monitoring lots of services commonly used in Rails apps. It’s got an instrumentation module for Mongoid, but unfortunately it doesn’t work (at least in Mongoid 2.0), because it’s instrumenting on methods on
Mongoid::Documentthat may or may not actually be called in the course of a query. Happily, we can add full instrumentation for Mongoid by adding traces to theMongoid::Collectionclass instead — this is the lowest layer of the Mongoid library before it starts making calls directly to the Mongo driver:Of course I’ll contribute this back upstream to rpm_contrib at some point, but until I find the time, feel free to enjoy the above.