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

Use Rack middleware for Padrino instrumentation #1142

Merged
merged 2 commits into from
Jul 4, 2024
Merged

Conversation

tombruijn
Copy link
Member

Update Sinatra test to assert EventHandler

I noticed this one scenario doesn't test if the EventHandler is present. Now it does check it.

Use Rack middleware for Padrino instrumentation

Refactor the Padrino instrumentation to use as much existing Rack middleware for instrumentation as possible.

Padrino is a framework built on Sinatra. We can reuse the Sinatra instrumentation middleware to instrument Padrino apps. In combination with the EventHandler we have 99% of the instrumentation done. To differentiate between Padrino and Sinatra events I've configured the Sinatra middleware to report the instrumentation event as a Padrino event.

The only thing we do need a monkeypatch for is the action name for Padrino. Everything else can be removed from the monkeypatch. The request metadata and exceptions are reported by the Sinatra middleware.

I've moved all the plugin initialization to the Padrino.before_load callback. It seems to initialize all the things we need before this time: app path and environment.

tombruijn added 2 commits July 3, 2024 11:01
I noticed this one scenario doesn't test if the EventHandler is present.
Now it does check it.
Refactor the Padrino instrumentation to use as much existing Rack
middleware for instrumentation as possible.

Padrino is a framework built on Sinatra. We can reuse the Sinatra
instrumentation middleware to instrument Padrino apps. In combination
with the EventHandler we have 99% of the instrumentation done.
To differentiate between Padrino and Sinatra events I've configured the
Sinatra middleware to report the instrumentation event as a Padrino
event.

The only thing we do need a monkeypatch for is the action name for
Padrino. Everything else can be removed from the monkeypatch. The
request metadata and exceptions are reported by the Sinatra middleware.

I've moved all the plugin initialization to the `Padrino.before_load`
callback. It seems to initialize all the things we need before this
time: app path and environment.
@tombruijn tombruijn merged commit f995e7c into main Jul 4, 2024
117 checks passed
@tombruijn tombruijn deleted the padrino-middleware branch July 10, 2024 18:37
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