-
Notifications
You must be signed in to change notification settings - Fork 21.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove child event tracking from ActiveSupport::Subscriber #43390
Merged
jhawthorn
merged 3 commits into
rails:main
from
jhawthorn:remove_notification_event_children
Feb 17, 2022
Merged
Remove child event tracking from ActiveSupport::Subscriber #43390
jhawthorn
merged 3 commits into
rails:main
from
jhawthorn:remove_notification_event_children
Feb 17, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jhawthorn
force-pushed
the
remove_notification_event_children
branch
from
January 17, 2022 18:49
d267a0d
to
297eb7a
Compare
jhawthorn
force-pushed
the
remove_notification_event_children
branch
from
February 16, 2022 03:04
297eb7a
to
30467a9
Compare
Previously ActiveSupport::Subscriber would manage its own events, keep them in a thread-local stack, and track "child" events of the same subscriber. I don't think this was particularly useful, since it only considered notifications delivered to the same subscriber, and I can't find evidence of this being used in the wild. I think this was intended to support tracing, but any uch tool would want to do this itself (at minimum in order to support multiple namespaces). Additionally, this has caused a few users to OOM in production environments, notably when queueing many jobs from another job.
Previously one subscriber was used for both the "Rendering" (before) and "Rendered" (after) events. With the previous change to AS::Subscriber these need to be split. Co-authored-by: Adam Hess <HParker@github.com>
jhawthorn
force-pushed
the
remove_notification_event_children
branch
from
February 17, 2022 16:20
30467a9
to
9c58a54
Compare
yykamei
added a commit
to yykamei/rails_band
that referenced
this pull request
Apr 4, 2022
`#children` has been deprecated as of Rails 7.2. rails/rails#43390 Unlike Rails, I decided to remove `#children` from `BaseEvent` since it'd be a techdebt to keep this method in the future, and I guess this method would not be used very well. By the way, I found this deprecation on Rails when I'm about to add the support for `deprecation.rails` on #89. I hope this won't cause problems for users who use this gem.
yykamei
added a commit
to yykamei/rails_band
that referenced
this pull request
Apr 4, 2022
`#children` has been deprecated as of Rails 7.2. rails/rails#43390 Unlike Rails, I decided to remove `#children` from `BaseEvent` since it'd be a techdebt to keep this method in the future, and I guess this method would not be used very well. By the way, I found this deprecation on Rails when I'm about to add the support for `deprecation.rails` on #89. I hope this won't cause problems for users who use this gem.
11 tasks
👋 I know it's not going to change anything, but event though this is marked as deprecated in 7.1, it's actually removed because the |
stevepolitodesign
added a commit
to thoughtbot/suspenders
that referenced
this pull request
Apr 23, 2024
The [introduction][] of `config/initializers/active_job.rb` was rendered obsolete by [rails/rails#43390][]. [introduction]: 38b530c [rails/rails#43390]: rails/rails#43390
stevepolitodesign
added a commit
to thoughtbot/suspenders
that referenced
this pull request
Apr 23, 2024
The [introduction][] of `config/initializers/active_job.rb` was rendered obsolete by [rails/rails#43390][]. Additionally, the following Rails 7 defaults match the [existing configuration][], so there is no need to redeclare them. ```ruby Rails.application.config.action_mailer.deliver_later_queue_name => nil Rails.application.config.action_mailbox.queues.routing => nil Rails.application.config.active_storage.queues.analysis => nil Rails.application.config.active_storage.queues.purge => nil Rails.application.config.active_storage.queues.mirror => nil ``` This is relevant because the next release of Suspenders will only support `rails >= 7.0`. [introduction]: 38b530c [rails/rails#43390]: rails/rails#43390 [existing configuration]: https://github.com/thoughtbot/suspenders/blob/bd40e33a585891afba380a7884284f5accc003cf/lib/suspenders/generators/jobs_generator.rb#L19-L23
stevepolitodesign
added a commit
to thoughtbot/suspenders
that referenced
this pull request
Apr 23, 2024
The [introduction][] of `config/initializers/active_job.rb` was rendered obsolete by [rails/rails#43390][]. Additionally, the following Rails 7 defaults match the [existing configuration][], so there is no need to redeclare them. ```ruby Rails.application.config.action_mailer.deliver_later_queue_name => nil Rails.application.config.action_mailbox.queues.routing => nil Rails.application.config.active_storage.queues.analysis => nil Rails.application.config.active_storage.queues.purge => nil Rails.application.config.active_storage.queues.mirror => nil ``` This is relevant because the next release of Suspenders will only support `rails >= 7.0`. [introduction]: 38b530c [rails/rails#43390]: rails/rails#43390 [existing configuration]: https://github.com/thoughtbot/suspenders/blob/bd40e33a585891afba380a7884284f5accc003cf/lib/suspenders/generators/jobs_generator.rb#L19-L23
stevepolitodesign
added a commit
to thoughtbot/suspenders
that referenced
this pull request
Apr 23, 2024
The [introduction][] of `config/initializers/active_job.rb` was rendered obsolete by [rails/rails#43390][]. Additionally, the following Rails 7 defaults match the [existing configuration][], so there is no need to redeclare them. ```ruby Rails.application.config.action_mailer.deliver_later_queue_name => nil Rails.application.config.action_mailbox.queues.routing => nil Rails.application.config.active_storage.queues.analysis => nil Rails.application.config.active_storage.queues.purge => nil Rails.application.config.active_storage.queues.mirror => nil ``` This is relevant because the next release of Suspenders will only support `rails >= 7.0`. [introduction]: 38b530c [rails/rails#43390]: rails/rails#43390 [existing configuration]: https://github.com/thoughtbot/suspenders/blob/bd40e33a585891afba380a7884284f5accc003cf/lib/suspenders/generators/jobs_generator.rb#L19-L23
stevepolitodesign
added a commit
to thoughtbot/suspenders
that referenced
this pull request
Apr 24, 2024
Follow-up to #1147 The [introduction][] of `config/initializers/active_job.rb` was rendered obsolete by [rails/rails#43390][]. Additionally, the following Rails 7 defaults match the [existing configuration][], so there is no need to redeclare them. ```ruby Rails.application.config.action_mailer.deliver_later_queue_name => nil Rails.application.config.action_mailbox.queues.routing => nil Rails.application.config.active_storage.queues.analysis => nil Rails.application.config.active_storage.queues.purge => nil Rails.application.config.active_storage.queues.mirror => nil ``` This is relevant because the next release of Suspenders will only support `rails >= 7.0`. [introduction]: 38b530c [rails/rails#43390]: rails/rails#43390 [existing configuration]: https://github.com/thoughtbot/suspenders/blob/bd40e33a585891afba380a7884284f5accc003cf/lib/suspenders/generators/jobs_generator.rb#L19-L23
stevepolitodesign
added a commit
to thoughtbot/suspenders
that referenced
this pull request
May 10, 2024
Follow-up to #1147 The [introduction][] of `config/initializers/active_job.rb` was rendered obsolete by [rails/rails#43390][]. Additionally, the following Rails 7 defaults match the [existing configuration][], so there is no need to redeclare them. ```ruby Rails.application.config.action_mailer.deliver_later_queue_name => nil Rails.application.config.action_mailbox.queues.routing => nil Rails.application.config.active_storage.queues.analysis => nil Rails.application.config.active_storage.queues.purge => nil Rails.application.config.active_storage.queues.mirror => nil ``` This is relevant because the next release of Suspenders will only support `rails >= 7.0`. [introduction]: 38b530c [rails/rails#43390]: rails/rails#43390 [existing configuration]: https://github.com/thoughtbot/suspenders/blob/bd40e33a585891afba380a7884284f5accc003cf/lib/suspenders/generators/jobs_generator.rb#L19-L23
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously
ActiveSupport::Subscriber
would manage its own events, keep them in a thread-local stack, and track "child" events of the same subscriber.I don't think this was particularly useful, since it only considered notifications delivered to the same subscriber, and I can't find evidence of this being used in the wild. I think this was intended to support tracing, but any such tool would want to do this itself (a minimum in order to support multiple namespaces).
Additionally, this has caused a few users to OOM in production environments, notably when queueing many jobs from another job. Based on the limited use and significant issues, I'd like to remove this tracking.
Based on my software archaeology this was introduced to solve issues seen in the newrelic agent #5932. The modern agent doesn't use this as far as I can tell (instead it builds and keeps track of its own events based on start/stop). IMO this implementation wouldn't be useful for it for the reasons described above.
In the second commit I remove
children
andparent_of?
. My thinking is that in the off chance anyone is using this it should error loudly. However if preferred I could return sensible default values and emit a deprecation warning.Anyone who needs this functionality can (and likely wants to) re-implement it in their own start/stop based subscription.
Fixes #21036 cc @pixeltrix (there's some discussion about nested tags for logging, which this change keeps intact 🙂)