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

Supported nested Rack EventHandlers #1101

Merged
merged 1 commit into from
Jun 20, 2024
Merged

Conversation

tombruijn
Copy link
Member

@tombruijn tombruijn commented Jun 19, 2024

In the case that an app, for whatever reason, has nested Rack EventHandlers, handle this properly.

This change makes it so that the EventHandler doesn't create multiple transactions if it's nested inside another EventHandler. It does this by assigning itself an ID (UUID), and adding it to the request environment. Then, on every callback it receives, it checks if it is the first EventHandler that handled the request. Only then does it do any instrumentation.

This will help with accidental multiple registrations of the AppSignal Rack EventHandler in one app, like with nested apps. It also opens the door for automatically registering the EventHandler for other gems, like Sinatra.

Part of #329

In the case that an app, for whatever reason, has nested Rack
EventHandlers, handle this properly.

This change makes it so that the EventHandler doesn't create multiple
transactions if it's nested inside another EventHandler. It does this by
assigning itself an ID (UUID), and adding it to the request environment.
Then, on every callback it receives, it checks if it is the first
EventHandler that handled the request. Only then does it do any
instrumentation.

This will help with accidental multiple registrations of the AppSignal
Rack EventHandler in one app, like with nested apps. It also opens the
door for automatically registering the EventHandler for other gems, like
Sinatra.
@tombruijn tombruijn merged commit 661b8e0 into main Jun 20, 2024
16 checks passed
@tombruijn tombruijn deleted the rack-nested-eventhandler branch July 10, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants