Skip to content

Instantly share code, notes, and snippets.

@outoftime
outoftime / collection.rb
Created February 11, 2011 15:02
Add NewRelic execution traces to Mongoid
if defined? ::NewRelic
module Mongoid
class Collection
(%w(find find_one map_reduce) + Collections::Operations::PROXIED - ['<<']).uniq.each do |method|
add_method_tracer method, "MongoDB/\#{@klass}##{method}"
end
end
end
end