Repository navigation
Add silenced? for Action View Start subscriber - #50751
Merged
Merged
Conversation
Previously, the `render_template.action_view` and `render_layout.action_view` events would always be handled as if they had subscribers even if the log level of its subscribers result in nothing being logged. For regular `LogSubscriber`s, `subscribe_log_level` could be used to optimize these cases but the Start subscriber is not a subclass of `LogSubscriber`. This commit implements a `#subscribed?` method for the Start subscriber so that it can also benefit from the `subscribe_log_level` optimization.
skipkayhil
force-pushed
the
hm-av-silenceable-start
branch
from
January 15, 2024 20:47
ef19528 to
d255ffd
Compare
nuclearspike
added a commit
to nuclearspike/rails
that referenced
this pull request
Jul 27, 2026
The structured-events rewrite (rails#55690) replaced the old render Start subscriber with a new class that dropped the silenced? method rails#50751 had added to its predecessor. Because the notifications Fanout treats subscribers without silenced? as permanently active, render_template.action_view and render_layout.action_view now run the full instrumentation machinery on every render in every environment, only for the emission to no-op inside ActiveSupport.event_reporter.debug when debug mode is off (the default outside development). Restoring silenced? (using the same two-condition shape as ActiveSupport::StructuredEventSubscriber#silenced? and the original rails#50751 fix) lets the notification layer skip that work at the source, exactly as the pre-structured-events subscriber did. Behavior in debug mode is unchanged. Co-Authored-By: Claude Fable 5 <[email protected]>
nuclearspike
added a commit
to nuclearspike/rails
that referenced
this pull request
Jul 29, 2026
The structured-events rewrite (rails#55690) replaced the old render Start subscriber with a new class that dropped the silenced? method rails#50751 had added to its predecessor. Because the notifications Fanout treats subscribers without silenced? as permanently active, render_template.action_view and render_layout.action_view now run the full instrumentation machinery on every render in every environment, only for the emission to no-op inside ActiveSupport.event_reporter.debug when debug mode is off (the default outside development). Restoring silenced? - silencing whenever the event reporter is not in debug mode, as the rails#50751 fix did for the log level - lets the notification layer skip that work at the source. Behavior in debug mode is unchanged. Co-Authored-By: Claude Fable 5 <[email protected]>
nuclearspike
added a commit
to nuclearspike/rails
that referenced
this pull request
Jul 30, 2026
The structured-events rewrite (rails#55690) replaced the old render Start subscriber with a new class that dropped the silenced? method rails#50751 had added to its predecessor. Because the notifications Fanout treats subscribers without silenced? as permanently active, render_template.action_view and render_layout.action_view now run the full instrumentation machinery on every render in every environment, only for the emission to no-op inside ActiveSupport.event_reporter.debug when debug mode is off (the default outside development). Restoring silenced? - silencing whenever the event reporter is not in debug mode, as the rails#50751 fix did for the log level - lets the notification layer skip that work at the source. Behavior in debug mode is unchanged. Co-Authored-By: Claude Fable 5 <[email protected]>
nuclearspike
added a commit
to nuclearspike/rails
that referenced
this pull request
Jul 30, 2026
The structured-events rewrite (rails#55690) replaced the old render Start subscriber with a new class that dropped the silenced? method rails#50751 had added to its predecessor. Because the notifications Fanout treats subscribers without silenced? as permanently active, render_template.action_view and render_layout.action_view now run the full instrumentation machinery on every render in every environment, only for the emission to no-op inside ActiveSupport.event_reporter.debug when debug mode is off (the default outside development). Restoring silenced? - silencing whenever the event reporter is not in debug mode, as the rails#50751 fix did for the log level - lets the notification layer skip that work at the source. Behavior in debug mode is unchanged. Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or 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
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.
Motivation / Background
Ref #45796
Previously, the
render_template.action_viewandrender_layout.action_viewevents would always be handled as if they had subscribers even if the log level of its subscribers result in nothing being logged. For regularLogSubscribers,subscribe_log_levelcould be used to optimize these cases but the Start subscriber is not a subclass ofLogSubscriber.Detail
This commit implements a
#silenced?method for the Start subscriber so that it can also benefit from thesubscribe_log_leveloptimization.Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]