-
Notifications
You must be signed in to change notification settings - Fork 281
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
Skip loading rack middleware with Rails' error reporting enabled? #1163
Comments
I second that question. |
@morgoth Reporting in the middleware is disabled when the Rails reporter is enabled, though the middleware itself isn't unloaded. Any double send should be reported as a bug. I didn't look at Active Job. If there's an issue there, I'll update. For people interested in fully unloading the middleware, there may be a way to do this that works for everyone. Here's the rationale for the way it is now. The middleware loads much earlier than initializers, where the Rollbar config is applied. Configuring the middleware to load after initializers (so a flag could be used to skip the middleware) would change current behavior for people who use it, and would leave no uncaught error handler enabled during that part of the init sequence. Loading it by default, and then unloading it during Rollbar init may be preferred by some people, but the middleware would still be there during that part of Rails init for everyone. Even when using the Rails error reporter/subscriber, the request and current user information collected from the Rack request by the middleware is added to those Rollbar payloads. Those may be available via the controller objects sent as context to the subscriber, but the Rails doc encourages people to reuse that argument for other things. It doesn't appear to be as consistent, or unlikely to change in the future. People who use the Rails reporter but also call methods like Because the Rails subscriber loads based on a config option, it loads at Rollbar init. The middleware is active until that time and then reporting is disabled when the subscriber is enabled. This provides uncaught error reporting until the subscriber is enabled. I may have overlooked a better way to do this, and I'm open to suggestions. |
A fairly straight forward solution at least for a transition phase could be to offer an alternative require that would not load the middleware at all:
I'm not terribly familiar with the internal structure of the rollbar gem, but I know this to work well for other gems, like |
With @waltjones' #1161 (adding support for Rails error reporter), shouldn't it be possible and actually desired to not load the Rack middleware?
The text was updated successfully, but these errors were encountered: