Skip to content
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

Fix Hanami instrumentation causing boot loop #1130

Merged
merged 2 commits into from
Jun 28, 2024
Merged

Conversation

tombruijn
Copy link
Member

@tombruijn tombruijn commented Jun 27, 2024

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

@tombruijn tombruijn added the bug label Jun 27, 2024
@tombruijn tombruijn self-assigned this Jun 27, 2024
@tombruijn tombruijn mentioned this pull request Jun 27, 2024
36 tasks
@tombruijn tombruijn force-pushed the hanami-dont-start-twice branch from 0da421f to b66677f Compare June 27, 2024 15:35
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.
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
@tombruijn tombruijn force-pushed the hanami-dont-start-twice branch from b66677f to 00b7ac6 Compare June 28, 2024 06:43
@tombruijn tombruijn changed the base branch from main to hanami-2.1-support June 28, 2024 06:43
@tombruijn tombruijn changed the base branch from hanami-2.1-support to main June 28, 2024 09:01
@tombruijn tombruijn merged commit 32143c8 into main Jun 28, 2024
16 checks passed
@tombruijn tombruijn deleted the hanami-dont-start-twice branch July 10, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants