-
Notifications
You must be signed in to change notification settings - Fork 150
feat: add Rails.event subscriber #734
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
Open
stympy
wants to merge
13
commits into
master
Choose a base branch
from
add-rails-event-subscriber
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ca17fab
Subscribe to Rails.event
stympy 38b0c00
Add a test for Rails.event.notify
stympy d3d2767
Simplify
stympy 16ed55f
Apply review suggestion
stympy c12143c
Revert "Simplify"
stympy d260b79
Check config before subscribing
stympy 34ee116
Fiddle with jruby test matrix
stympy 5acb11e
Whitespace
stympy 7afd2c6
Gemfile updates for Rails 8+ and JRuby
stympy 22a25e9
Avoid ActiveRecord problems with JRuby and Rails 8
stympy 7aa88a0
Don't test Rails 8 with JRuby 9
stympy 53b1add
Merge branch 'master' into add-rails-event-subscriber
stympy 7857ff0
Add a new configuration option for Rails.event events
stympy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| require_relative "../rails_helper" | ||
|
|
||
| describe "Rails Insights Event Subscriber", if: RAILS_PRESENT, type: :request do | ||
joshuap marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| load_rails_hooks(self) | ||
|
|
||
| before do | ||
| Honeybadger.config[:"insights.enabled"] = true | ||
| Honeybadger.config[:"events.batch_size"] = 0 | ||
|
|
||
| Honeybadger::Backend::Test.events.clear | ||
| end | ||
|
|
||
| it "subscribes to Rails.event when available", if: defined?(Rails.event) do | ||
| Rails.event.notify("test.rails_event", {rails_key: "rails_value"}) | ||
|
|
||
| sleep(0.1) | ||
|
|
||
| rails_events = Honeybadger::Backend::Test.events.select { |e| e[:event_type] == "test.rails_event" } | ||
| expect(rails_events).not_to be_empty | ||
| expect(rails_events.first[:payload][:rails_key]).to eq("rails_value") | ||
| expect(rails_events.first[:name]).to be_blank | ||
| end | ||
|
|
||
| it "gracefully handles Rails.event when not available", unless: defined?(Rails.event) do | ||
| expect { Honeybadger::Plugin.instances[:rails].load!(Honeybadger.config) }.not_to raise_error | ||
| end | ||
| end | ||
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.
Uh oh!
There was an error while loading. Please reload this page.