alphagov/content-store — pull request #70 by tekin (2014-11-03 15:11:30+00:00)
Title: Add MongoDB instrumentation to action logging

We can generate more fine-grained instrumentation of MongoDB queries directly in the request logs by subscribing to the notifications generated by moped (the connection adapter used by mongoid). For example:

```
Started GET "/content/contact/cabinet-office/office-1" for 127.0.0.1 at 2014-11-03 15:08:08 +0000
Processing by ContentItemsController#show as HTML
Parameters: {"base_path"=>"/contact/cabinet-office/tekin"}
Completed 200 OK in 3ms (Views: 1.2ms | Mongo: 0.7ms)
```

This code follows the same patterns that `ActiveRecord` uses to output the SQL query runtimes.