| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
We sometimes say "✂️ newline after `private`" in a code review (e.g.
https://github.com/rails/rails/pull/18546#discussion_r23188776,
https://github.com/rails/rails/pull/34832#discussion_r244847195).
Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style
`EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059).
That cop and enforced style will reduce the our code review cost.
|
|
|
|
|
|
|
| |
This is a regression for #36184.
And also, add new `monotonic` argument to the last of the method
signature rather than the first.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
'ActiveSupport::Notifications::Fanout::Subscribers::MonotonicTimed' and 'ActiveSupport::Notifications::monotonic_subscribe'
Also, change the signature of ‘ActiveSupport::Notifications::Fanout#subscribe’ to accept optional ‘monotonic’ boolean argument. Then initialize either a ‘Timed’ or ‘MonotonicTimed’ subscriber based on the value of ‘monotonic’ parameter.
Introduce ‘ActiveSupport::Notifications::monotonic_subscribe’ method
Also, provision ‘ActiveSupport::Notifications::subscribed’ to optionally accept ‘monotonic’ boolean argument.
Update documentation for ActiveSupport::Notifications
Add tests
Update guides documentation under the 'Active Support Instrumentation' chapter
Incorporate feedback: use optional keyword argument to specify optional 'monotonic' option to 'subscribed' method
Fix a typo
|
|
|
|
|
|
|
|
|
|
| |
The change to monotonic times causes failures for applications
where the subscribed block is expecting Time objects as described
in this issue: https://github.com/rails/rails/issues/36145
The original PR (https://github.com/rails/rails/pull/35984) was
concerned with errors on the cpu_time. Test was edited to reflect
changes to initializer using 0 values instead of nil
|
|
|
|
| |
variables such as @cpu_time, @idle_time and @allocations; this reduces one allocation
|
|
|
|
| |
event subscribed by a `ActiveSupport::Notifications::Fanout::Subscribers::Timed` subscriber
|
|
|
|
| |
`ActiveSupport::Notifications::Fanout::Subscribers::Timed` subscriber
|
|
|
|
| |
with change to ActiveSupport::Notifications::Instrumenter#instrument
|
|
|
|
|
| |
* Update #instrument to make passing a block optional. This will let users
leverage #instrument for messaging in addition to instrumentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As of [Revision 66772](
https://bugs.ruby-lang.org/projects/ruby-trunk/repository/trunk/revisions/66772)
`Proc.new` without giving a block emits `warning: tried to create Proc object without a block`.
This commit fixes cases where Rails test suit tickles this warning.
See CI logs:
https://travis-ci.org/rails/rails/jobs/487205819#L1161-L1190
https://travis-ci.org/rails/rails/jobs/487205821#L1154-1159
https://travis-ci.org/rails/rails/jobs/487205821#L1160-L1169
https://travis-ci.org/rails/rails/jobs/487205821#L1189
https://travis-ci.org/rails/rails/jobs/487254404#L1307-L1416
https://travis-ci.org/rails/rails/jobs/487254405#L1174-L1191
|
|\
| |
| | |
use ProxyPattern to match for ActiveSupport::Notifications fanout/unsubscribe
|
| | |
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've found a few places in Rails code base where I think it makes sense
to calculate elapsed time more precisely by using
`Concurrent.monotonic_time`:
- Fix calculation of elapsed time in `ActiveSupport::Cache::MemoryStore#prune`
- Fix calculation of elapsed time in
`ActiveRecord::ConnectionAdapters::ConnectionPool::Queue#wait_poll`
- Fix calculation of elapsed time in
`ActiveRecord::ConnectionAdapters::ConnectionPool#attempt_to_checkout_all_existing_connections`
- Fix calculation of elapsed time in `ActiveRecord::ConnectionAdapters::Mysql2Adapter#explain`
See
https://docs.ruby-lang.org/en/2.5.0/Process.html#method-c-clock_gettime
https://blog.dnsimple.com/2018/03/elapsed-time-with-ruby-the-right-way
Related to 7c4542146f0dde962205e5a90839349631ae60fb
|
|
|
|
|
|
|
|
|
| |
When adding/removing a subscription with a string pattern, it isn't
necessary to clear the entire cache, only the cache for the key being
added.
When adding/removing subscriptions for a regex or to match all events,
the full cache is still cleared.
|
|
|
|
|
|
|
|
|
|
| |
Previously we stored all subscribers in an array, and every time a new
message name came in asked each subscriber if they responded to the
message.
This commit changes Fanout to hash subscribers with a String pattern by
their pattern. This way we can look them up directly and only do the
O(N) scan over the non-string (Regex or any) patterns.
|
| |
|
|
|
|
|
|
|
|
| |
Since #33449, `event.end = Time.now` is not used anymore and should use
`event.finish!`.
We can't use `deprecate :end=` in definition time in this module due to
circular require in `active_support/deprecation/behaviors`.
|
|
|
|
|
| |
Add Windows support for `ActiveSupport::Testing::Parallelization`
and `ActiveSupport::Notifications::Instrumenter`.
|
|
|
|
| |
It's not defined on JRuby and unlike monotonic time, concurrent-ruby doesn't have an cross-platform abstraction for this.
|
| |
|
|
|
|
|
|
|
| |
We don't need to have a special subscribe method for objects. The
regular `subscribe` method is more expensive than a specialized method,
but `subscribe` should not be called frequently. If that turns out to
be a hotspot, we can introduce a specialized method. :)
|
|
|
|
|
|
| |
Fanout notifier can send event objects to subscribers now. Also moved
`end` lower in the `finish!` method to guarantee that CPU time is
shorter than real time.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Use process clock instead of Time.now
This fixes any issues with the system clock changing and also eliminates
2 object allocations per event.
* Add start! and finish! methods to the event object so we can record
more information
* Adds cpu time, idle time, and allocation count for a particular event.
Co-authored-by: Aaron Patterson <aaron.patterson@gmail.com>
|
| |
|
| |
|
|
|
|
|
| |
This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing
changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
|
|
|
|
|
|
|
| |
- Adds new key/value pair to payload when an exception is raised
e.g. `:exception_object=> #<RuntimeError: FAIL>`
- Updates relevant test
- Adds CHANGELOG entry
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
The thread_safe gem is being deprecated and all its code has been merged
into the concurrent-ruby gem. The new class, Concurrent::Map, is exactly
the same as its predecessor except for fixes to two bugs discovered
during the merge.
|
| |
|
|
|
|
|
|
|
|
| |
@rafaelfranca suggested in f7c7bcd9 that code examples should display
the result after `# =>` and not after `#=>`.
This commit replaces *all* the occurrences of `#=>` in the code documentation
(mostly added by me :sob:) with the suggested `# =>`.
|
|
|
|
|
|
|
|
|
| |
Stems from comments by @zzak on e07f3dd:
* https://github.com/rails/docrails/commit/e07f3ddcac394d2a8dc23fc571318b7e8c2497b1#commitcomment-9015634
* https://github.com/rails/docrails/commit/e07f3ddcac394d2a8dc23fc571318b7e8c2497b1#commitcomment-9015639
[ci skip]
|
|
|
|
| |
[ci skip]
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
Conflicts:
activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
activerecord/test/cases/adapter_test.rb
guides/source/testing.md
[ci skip]
|
| | |
|
|/
|
|
| |
its payload the same way that ActiveSupport::Notifications does.
Fix spelling in test name.
|
| |
|