Don't send healthcheck events to AppSignal to save storage#842
Don't send healthcheck events to AppSignal to save storage#842northeastprince wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a Rails initializer to prevent health check controller events from being reported to AppSignal, reducing monitoring noise/storage for /up requests.
Changes:
- Introduces a
to_preparehook that locates the AppSignal ActiveSupport event subscriber. - Replaces the original subscriber with a wrapper that skips emitting health check events.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| next unless original_subscriber_entry | ||
|
|
||
| subscribers.delete original_subscriber_entry | ||
|
|
||
| filtered_subscriber = Class.new do |
There was a problem hiding this comment.
subscribers is not defined in this initializer. As written, this will raise a NameError when original_subscriber_entry is present, and the AppSignal subscriber will never be replaced. Assign the subscribers collection to a local (e.g., from Rails.event.instance_variable_get(:@subscribers)) and delete from that collection, or otherwise use the public API (if available) to unsubscribe the original entry before re-subscribing the filtered wrapper.
f1a44c3 to
d434e51
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def with_filtered_event_reporter | ||
| original = ActiveSupport.event_reporter | ||
| ActiveSupport.event_reporter = FilteredEventReporter.new(original) | ||
| yield | ||
| ensure | ||
| ActiveSupport.event_reporter = original | ||
| end |
There was a problem hiding this comment.
This test mutates the global ActiveSupport.event_reporter. Since the test suite is configured to run in parallel (parallelize in test/test_helper.rb), this can cause cross-test interference and flaky failures when other tests emit events concurrently. Consider making this test non-parallel-safe (disable parallelization for this class) or avoid changing the global reporter by using a local subscriber/spies that only observes events within the block.
No description provided.