Fix Hanami instrumentation causing boot loop #1130
Merged
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.
Based on #1127
Improve Hanami integration testing
Improve testing for the Hanami integration by making sure the it prepends the module in every scenario. That means we're not really prepending the module to Hanami::Action in the tests, because that would make testing it multiple times impossible. It's not possible to "unprepend" a module.
I've updated the prepended module test to prepend the module to an Action class. First it subclasses the Hanami Action fixture using an anonymous class (using
Class.new
). Then it prepends the module to that anonymous class to see if the behavior works.Don't start again in Hanami integration
When AppSignal is already active, do not start AppSignal again. This is a good precaution as it prevents boot loops, when AppSignal is started twice with different configurations.
This will improve support for nested Hanami applications, when they're mounted in another frameworks we support, like Rails or Sinatra.
This is similar to PR #1105
Part of #329