Timeasure is a Ruby gem created and maintained by Eliav Lavi & Riskified. Timeasure allows measuring the runtime of methods without having to alter the code of the methods themselves. Timeasure is intended to be used in production environments in order to achieve a real picture of methods' runtime. It is indeed used in production in Riskified, however please note that it is still in its pre-release period, so please take extra care and check it locally before deploying to production.
To achieve an easy and intuitive interface, Timeasure offers elegant class macros, similar in syntax to Ruby's attr_accessor or Rails' validates_uniquness_of.
Timeasure handles the runtime measurement of declared tracked methods and aggregates them on the method level. It is recommended to report this data to an analytics framework that allows insights gathering the end of transaction. Timeasure was designed with NewRelic Insights as the "inspiration on the other end", but it is generic enough to fit to other analytics frameworks.
Below is a possible usage of Timeasure within a given class. Notice how the declaration of which methods to track only changes the code at the top of the class while the tracked methods remain intact: