Module: Sixty::Instrument::ActionController
- Defined in:
- lib/sixty/instrument/action_controller.rb
Overview
Controller actions, as operations of their own.
The Rack span says a request took 900ms. The query spans say the database
took 40ms. Without a span in between, the remaining 860ms lands on the
request as self time — true, but not actionable: "GET /orders got slower"
names an endpoint, not a change. OrdersController#index names the method
somebody edited.
It is also the layer that makes fanout readable. db_calls is credited to
every ancestor, so an N+1 introduced in a controller shows up here as the
call count changing, which is the sentence a person can act on: "this
action went from 3 queries to 41".
process_action is the hook rather than an around_action for one
reason: an around_action can be skipped, reordered, or short-circuited by
another filter — including a before_action that renders and halts, which
is exactly the request whose measurement matters most.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.install ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/sixty/instrument/action_controller.rb', line 32 def self.install return false unless defined?(::ActiveSupport) ::ActiveSupport.on_load(:action_controller) do # `self` here is ActionController::Base or ::API, whichever the # application loaded — both, in an app that has each. prepend Sixty::Instrument::ActionController end true end |