Wrapping Up

In this chapter, we developed a Rails engine that listens to all actions an application processes, and stores them in MongoDB. We can see these notifications by accessing /mongo_metrics in the browser.

Our implementation was built atop a mountable and isolated engine, which allows us to build our features isolated from a Rails application, guaranteeing we won’t have conflicts in the most likely places, such as routes and helpers. We also explored Rack by creating middleware that allows us to mute the metrics storage on particular areas of our plug-in and by using a custom Rack body to stream data.

There’s still a lot to be done in our plug-in when it comes to the visualization part. We could, for instance, allow the developer ...

Get Crafting Rails 4 Applications, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.