This project is archived and is in readonly mode.

#4594 open
Justin George

Add methods for including start events with notified actions

Reported by Justin George | May 13th, 2010 @ 11:37 PM | in 3.1

The use case here is essentially for callback-esque use cases - we want to note when a sql transaction has begun, and when it has ended, as seperate events.

A use case for this is to notice when sql queries are hanging, or for noticing which order queries are starting in without reference to their final length.

ActiveSupport::Notifications.subscribe(/sql.active_record/) do |name, *args|
  @events << name
end

ActiveSupport::Notifications.instrument_with_start('sql.active_record', {:some => 'payload'}) do
  # query logic
end

@events.inspect #=> ['sql.active_record.start', 'sql.active_record']

Open to suggestions on what to call it, and how it should work.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Referenced by

Pages