module Marginalia::ActionControllerInstrumentation

def self.included(instrumented_class)

def self.included(instrumented_class)
  instrumented_class.class_eval do
    if respond_to?(:around_action)
      around_action :record_query_comment
    else
      around_filter :record_query_comment
    end
  end
end

def record_query_comment

def record_query_comment
  Marginalia::Comment.update!(self)
  yield
ensure
  Marginalia::Comment.clear!
end