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

Replace Hanami monkeypatch with middleware #911

Closed
4 tasks done
tombruijn opened this issue Jan 16, 2023 · 4 comments
Closed
4 tasks done

Replace Hanami monkeypatch with middleware #911

tombruijn opened this issue Jan 16, 2023 · 4 comments
Assignees
Labels

Comments

@tombruijn
Copy link
Member

tombruijn commented Jan 16, 2023

TODO


@tombruijn
Copy link
Member Author

tombruijn commented Jun 24, 2024

Looked into subscribing to Dry Monitor events for Rack, as mentioned here. This is not useful, because it doesn't include any route information (or in Hanami here. Request instrumentation is better done with our Rack EventHandler or a subclass of AbstractMiddleware.

@tombruijn tombruijn self-assigned this Jun 25, 2024
tombruijn added a commit that referenced this issue Jun 25, 2024
As part of #329, update the Hanami integration to use Rack middleware
and the EventHandler to instrument requests made to Hanami apps. This
standardizes the instrumentation as much as possible between Rack apps
and minimizes our reliance on monkeypatches.

The only monkeypatch that remains is setting the action name to the
Action class name. I have found no other way yet to fetch this metadata
from the request metadata, environment or the Hanami router.

Part of #329
Mostly solves #911
tombruijn added a commit that referenced this issue Jun 25, 2024
As part of #329, update the Hanami integration to use Rack middleware
and the EventHandler to instrument requests made to Hanami apps. This
standardizes the instrumentation as much as possible between Rack apps
and minimizes our reliance on monkeypatches.

The only monkeypatch that remains is setting the action name to the
Action class name. I have found no other way yet to fetch this metadata
from the request metadata, environment or the Hanami router.

Part of #329
Mostly solves #911
tombruijn added a commit that referenced this issue Jun 25, 2024
As part of #329, update the Hanami integration to use Rack middleware
and the EventHandler to instrument requests made to Hanami apps. This
standardizes the instrumentation as much as possible between Rack apps
and minimizes our reliance on monkeypatches.

The only monkeypatch that remains is setting the action name to the
Action class name. I have found no other way yet to fetch this metadata
from the request metadata, environment or the Hanami router.

Part of #329
Mostly solves #911
tombruijn added a commit that referenced this issue Jun 25, 2024
As part of #329, update the Hanami integration to use Rack middleware
and the EventHandler to instrument requests made to Hanami apps. This
standardizes the instrumentation as much as possible between Rack apps
and minimizes our reliance on monkeypatches.

The only monkeypatch that remains is setting the action name to the
Action class name. I have found no other way yet to fetch this metadata
from the request metadata, environment or the Hanami router.

Part of #329
Mostly solves #911
tombruijn added a commit that referenced this issue Jun 25, 2024
As part of #329, update the Hanami integration to use Rack middleware
and the EventHandler to instrument requests made to Hanami apps. This
standardizes the instrumentation as much as possible between Rack apps
and minimizes our reliance on monkeypatches.

The only monkeypatch that remains is setting the action name to the
Action class name. I have found no other way yet to fetch this metadata
from the request metadata, environment or the Hanami router.

Part of #329
Mostly solves #911
tombruijn added a commit that referenced this issue Jun 25, 2024
As part of #329, update the Hanami integration to use Rack middleware
and the EventHandler to instrument requests made to Hanami apps. This
standardizes the instrumentation as much as possible between Rack apps
and minimizes our reliance on monkeypatches.

The only monkeypatch that remains is setting the action name to the
Action class name. I have found no other way yet to fetch this metadata
from the request metadata, environment or the Hanami router.

Part of #329
Mostly solves #911
@tombruijn
Copy link
Member Author

Asked for more insights on the Hanami discourse

@tombruijn
Copy link
Member Author

Tracking issue for the change to report the action name in the request env in the Hanami project: hanami/controller#445

@tombruijn
Copy link
Member Author

tombruijn commented Nov 4, 2024

PR merged in the Hanami project. We can pick this up. Maybe wait until it's released so we can test it in a real app.

tombruijn added a commit that referenced this issue Nov 5, 2024
Remove the need for the monkeypatch in the Hanami loader and fetch the
Hanami action instance from the request env to determine the action
name.

I'll remove the monkeypatch in the next commit.

This only works on Hanami 2.2 and newer.

Part of #911
tombruijn added a commit that referenced this issue Nov 5, 2024
In the previous commit we started reading the action name from the
Hanami Action instance on the request env.

Disable the monkeypatch on Hanami 2.2+ so it's not doing the same thing
twice. We'll leave the monkeypatch for now, but eventually we should be
able to remove it. Like on the next major Hanami version or after some
years.

Part of #911
tombruijn added a commit that referenced this issue Nov 5, 2024
Remove the need for the monkeypatch in the Hanami loader and fetch the
Hanami action instance from the request env to determine the action
name.

I'll remove the monkeypatch in the next commit.

This only works on Hanami 2.2 and newer.

Part of #911
tombruijn added a commit that referenced this issue Nov 5, 2024
In the previous commit we started reading the action name from the
Hanami Action instance on the request env.

Disable the monkeypatch on Hanami 2.2+ so it's not doing the same thing
twice. We'll leave the monkeypatch for now, but eventually we should be
able to remove it. Like on the next major Hanami version or after some
years.

Part of #911
tombruijn added a commit that referenced this issue Nov 11, 2024
Remove the need for the monkeypatch in the Hanami loader and fetch the
Hanami action instance from the request env to determine the action
name.

I'll remove the monkeypatch in the next commit.

This only works on Hanami 2.2 and newer.

Part of #911
tombruijn added a commit that referenced this issue Nov 11, 2024
In the previous commit we started reading the action name from the
Hanami Action instance on the request env.

Disable the monkeypatch on Hanami 2.2+ so it's not doing the same thing
twice. We'll leave the monkeypatch for now, but eventually we should be
able to remove it. Like on the next major Hanami version or after some
years.

Part of #911
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant