Scout Rails Instrumentation
The instrumentation occurring in the Rails application will be passed into the
DB queue for processing by the plugin.
The Rails Plugin (instrumentation hooks) should result in data able to recreate
a report like the following:
The data for each action will basically come down to:
- database query time (min, max, avg)
- render time (min, max, avg)
- total time (min, max, avg)
- slow queries
- total time
This is calculated for each action, totaling/figuring averages for actions
called multiple times in the same report window.
Each report should also calculate the overall throughput from the number of
The instrumentation will mainly hook into the ActionController::Dispatcher class
which provides us a way to access the calculations that Rails does
We will not be concerned with getting the snapshots from the Rails app, but
instead this will happen externally.
The Rails app will have the data sent to the external Scout process for queueing
and eventually for processing. James suggested that either we provide a
command-line interface that we pipe the data out to or a normal Ruby interface
to send the data to.
I imagine that this could look something like this:
IO.popen("scout-queue rails", "w") do |queue| queue << Marshall.dump(stats) end
The data will eventually get parsed and look something like: