Commit Graph

56 Commits

Author SHA1 Message Date
Daniel Colson fda1863e1a Remove extra whitespace 2018-01-25 23:32:59 -05:00
Koichi ITO ac717d65a3 [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment` 2017-07-11 13:12:32 +09:00
Kir Shatrov 72950568dd Use frozen-string-literal in ActiveSupport 2017-07-09 15:08:29 +03:00
Matthew Draper 87b3e226d6 Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"
This reverts commit 3420a14590, reversing
changes made to afb66a5a59.
2017-07-02 02:15:17 +09:30
Kir Shatrov cfade1ec7e Enforce frozen string in Rubocop 2017-07-01 02:11:03 +03:00
Akira Matsuda 3fe6a5d510 Privatize unneededly protected methods in Active Support tests 2016-12-24 00:22:29 +09:00
Rafael Mendonça França 55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Xavier Noria 5c315a8fa6 modernizes hash syntax in activesupport 2016-08-06 19:38:33 +02:00
Xavier Noria a731125f12 applies new string literal convention in activesupport/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:10:53 +02:00
Ryan T. Hosford 3e48bfd497 Adds exception object to instrumenter's payload
- Adds new key/value pair to payload when an exception is raised
    e.g. `:exception_object=> #<RuntimeError: FAIL>`
  - Updates relevant test
  - Adds CHANGELOG entry
2015-12-31 01:48:22 -06:00
thedarkone ab3c4a4083 Subscribing to notifications while inside the said instrumented section.
The issue is that on the exit from Instrumenter#instrument section,
an Evented listener will run into an error because its thread local
(Thread.current[:_timestack]) has not been set up by the #start
method (this obviously happens because the Evented listeners didn't
exist at the time, since no subscribtion to that section was made yet).

Note: support for subscribing to instrumented sections, while being
inside those instrumented sections, might be removed in the future.

Maybe fixes #21873.
2015-11-28 01:40:21 +01:00
Carl Lerche e539228d08 Bug fix: Evented notification subscribers can handle published events 2013-05-17 16:27:23 -07:00
Prathamesh Sonpatki b5429eec60 Fix Typo existant -> existent [ci skip] 2013-05-08 09:50:46 +05:30
stopdropandrew a007800a55 ActiveSupport::Notifications::Instrumenter#instrument should yield
its payload the same way that ActiveSupport::Notifications does.
Fix spelling in test name.
2013-03-02 16:05:05 -08:00
タコ焼き仮面 c6d86a5db4 make events not use date and time to determine parent_of. fixes #5932 2012-06-18 16:34:23 -07:00
Xavier Noria d287e90870 implements AS::Notifications.subscribed, which provides subscriptions to events while a block runs 2011-11-05 12:02:54 -07:00
Arun Agrawal 83eec4ca4c Requiring delegate. 2011-08-16 01:36:21 +05:30
Jon Leighton d411c85a65 Replace references to ActiveSupport::SecureRandom with just SecureRandom, and require 'securerandom' from the stdlib when active support is required. 2011-05-23 20:25:44 +01:00
Aaron Patterson 3e02b3702e just use an attr_accessor so we do not pay ||= on every notification call 2011-02-09 14:02:38 -08:00
José Valim ff0d842454 Revert the previous three commits.
* AS::Notifications#instrument should not measure anything, it is not its responsibility;

* Adding another argument to AS::Notifications#instrument API needs to be properly discussed;
2010-07-25 20:46:42 +02:00
Aaron Patterson b7e0408ca9 use a hash to collect optional statistics about the instrumentation 2010-07-25 11:11:23 -07:00
José Valim 834bd23a07 Get rid of instrumenter.elapsed. 2010-07-24 10:22:22 +02:00
José Valim 9df9c4bac0 Add a test for elapsed and require missing benchmark file. 2010-07-20 17:07:18 +02:00
Santiago Pastorino 3870366092 Float comparison adjustment
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-07-18 19:28:46 +02:00
Santiago Pastorino 725090942f We shouldn't rely on float comparison, delta added just in case float representation of this values aren't equal 2010-07-12 09:59:52 +08:00
José Valim a76c7e68d5 Event should be aware if yielded block failed or not. 2010-05-02 22:45:54 +02:00
Justin George 109d3ee38d Make notifications go off even when an error is raised, so that we capture the underlying performance data [#4505 state:resolved]
This is important when trying to keep track of many layers of interrelated calls

i.e.:

ActiveRecord::Base.transaction do
  MyModel.find(1) #ActiveRecord::NotFound
end # should capture the full time until the error propagation

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-02 22:45:53 +02:00
David Chelimsky 864bd9c21f allow unsubscribe by name or subscription [#4433 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-24 22:06:24 -07:00
José Valim a6dc227167 Mark bang instrumentations as something that you shuold not be listening to. 2010-03-17 23:44:03 +01:00
Carlhuda fc0882ba5a Optimize AS::Notifications to remember which subscribers don't match and not run them. This will allow notifications that are only useful in dev or testing to run efficiently in production. 2010-03-01 17:45:37 -08:00
Carlhuda c88360ef36 You can unsubscribe a subscriber 2010-03-01 17:45:37 -08:00
Prem Sichanugrist f0523f72b4 Rename Rails::Subscriber to Rails::LogSubscriber 2010-02-16 22:36:15 +01:00
José Valim 31248fe369 Remove instrument! and require thread from AS::Notifications. 2010-02-04 10:39:55 +01:00
Mikel Lindsaar 2ebea1c02d deOMGifying Railties, Active Support, and Action Pack 2010-01-31 09:46:30 -08:00
José Valim 378464a2e4 Default to sync instrumentation. 2010-01-21 13:09:12 +01:00
José Valim 0334f9f6cf Add ActionDispatch::Notifications middleware. 2010-01-17 11:29:51 +01:00
José Valim 7f4d8e3fbd Yield the payload notifications for further modification (like adding the result). 2010-01-15 12:24:31 +01:00
José Valim 7c3573f327 Add instrument! to notifications which adds the result to the payload. 2010-01-14 01:07:03 +01:00
José Valim 4704af763f Do not send notifications when instrumentation raise an error. 2010-01-13 01:19:22 +01:00
José Valim 74f6ccea20 instrumenter should be accessible from ActiveSupport::Notifications. 2010-01-06 22:24:16 +01:00
José Valim 45462c5e41 Expose Instrumenter id in Notifications. 2010-01-04 23:05:28 +01:00
José Valim 75ba102a80 Remove ActionView inline logging to ActiveSupport::Notifications and create ActionController::Base#log_event, so everything can be logged within one listener. Also expose log_process_action as a hook for different modules to include their own information during the action processing. This allow ActiveRecord to hook and any other ORM. Finally, this commit changes 'Processing' and 'Rendering' in logs to 'Processed' and 'Rendered' because at the point it's logged, everying already happened. 2009-12-26 20:28:53 +01:00
Jeremy Kemper 327545c3ae Notifications: synchronous fanout queue pushes events to subscribers rather than having them concurrently pull 2009-11-29 02:30:35 -08:00
Jeremy Kemper 4f2a04cc08 Notifications: extract central Notifier, cordon off the internal Fanout implementation, and segregate instrumentation concerns 2009-11-28 12:50:09 -08:00
Jeremy Kemper ddf681ce1d Expose a simple Queue#wait to block until all notifications are drained 2009-11-28 12:50:09 -08:00
Jeremy Kemper 6f7fc5824f Revert "Create SyncListener. Since they do not rely on Thread, they can be used on Google App Engine."
Take a step back on this API direction.

This reverts commit 8104f65c32.
2009-11-28 12:50:09 -08:00
José Valim 8104f65c32 Create SyncListener. Since they do not rely on Thread, they can be used on Google App Engine.
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
2009-11-23 09:08:17 -08:00
Jeremy Kemper 58c0d31487 Notifications: queue.drained? for testability in place of brittle sleeps 2009-11-13 20:58:38 -08:00
Jeremy Kemper 66fda6b894 Fix duration check for longer sleep 2009-11-13 19:28:59 -08:00
Jeremy Kemper 7ab78b9ccd CI: slow down brittle notifications tests 2009-11-13 18:57:10 -08:00