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

Monkey patching of Rails::Rack::Logger#call_app loses request.action_dispatch instrumentation #329

Open
md5 opened this issue Jul 8, 2021 · 1 comment

Comments

@md5
Copy link

md5 commented Jul 8, 2021

I was looking into how lograge is interacting with Rails::Rack::Logger and noticed that the overrides for #call_app are losing calls to ActiveSupport::Notifications.instrumenter for the request.action_dispatch notification. It looks like this instrumentation in Rails has existed since Rails 4.0 (added in January 2013 in rails/rails@ffa9540).

It seems like lograge should not be removing this functionality given that it requires Rails >= 4, but I'm also not aware of anything specific that this breaks. Nothing in Rails itself subscribes to that notification and I can't find code in any common monitoring gems that specifically subscribes to it either. Feel free to close this issue if this isn't something you feel needs to be remedied. I don't see a good way of fixing this other than copying the code from Rails. Overriding #started_request_message to return nil could be a possibility, but this would still result in a nil message being processed by #info since there is no special handling of nil in Logger.

@nmoadev
Copy link

nmoadev commented Jan 7, 2022

request.action_dispatch event isn't actually documented in the Rails guide for https://guides.rubyonrails.org/active_support_instrumentation.html

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

No branches or pull requests

2 participants