-
Notifications
You must be signed in to change notification settings - Fork 898
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 rails deprecation behavior but log in production #18847
Use rails deprecation behavior but log in production #18847
Conversation
There is no technical difference but clean up the settings.
Change from rails :notify default since it's unlikely we'll have users setup notifications for depecation warnings.
|
||
# Change from rails :notify default since it's unlikely we'll have users setup | ||
# notifications for deprecation warnings. | ||
config.active_support.deprecation = :log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the 🍖 of the PR. The default of notify is great when hosted as you can setup notifications for these. Since most of our users are not hosted by us, it will be unlikely we'll ever get deprecations reported to us unless we get them by default from logging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure...see my comment below. What does this solve that we couldn't do previously?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecations, especially rails ones, should be exceptional. I'd like to stay on top of them so future upgrades are easier. Note, this doesn't affect Vmdb::Deprecation
as that will never log in production so this only logs rails deprecations, ones we should definitely stay on top of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have a lot of code suppressing the notifications in production? At least for our own deprecations.
UPDATE: ugh, you just said that
# Print deprecation notices to the stderr | ||
#ActiveSupport::Deprecation.behavior = :stderr | ||
# Print deprecation notices to the stderr. | ||
config.active_support.deprecation = :stderr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the syntax for this to the defaults from rails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
|
We've classically had deprecations off because in production mode (i.e. at customers) it's just noise. It's not like they can fix it. |
# Send deprecation notices to registered listeners | ||
config.active_support.deprecation = :notify | ||
# Send deprecation notices to registered listeners. | ||
# config.active_support.deprecation = :notify |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does a vanilla production.rb have both lines, but one commented out? If not, then I would think we'd just delete this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I left it because the comment is wrong with this line saying :log
instead of :notify
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I drop the the line that ships with rails, I should drop the comment too. They should stay or go together.
We shouldn't go out the door with any known Rails deprecation warnings, right? We need to find out about any that remain and fix them before those methods are removed or changed. (and add tests) |
Checked commits jrafanie/manageiq@bac06ac~...201ebfe with ruby 2.3.3, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
👍 The reason to do this is to stay on top of fixing deprecations so they're not noisy. Any logs we receive we can look for deprecations and try to stay in front of them so upgrades are easier. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Printing out deprecations is great.
Not sure the best way to encourage people to actually fix these deprecations rather than just live with them.
|
||
# Change from rails :notify default since it's unlikely we'll have users setup | ||
# notifications for deprecation warnings. | ||
config.active_support.deprecation = :log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have a lot of code suppressing the notifications in production? At least for our own deprecations.
UPDATE: ugh, you just said that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My 2Cents (aside from the snark): I think this is a fine approach. Effectively we are crowd source our deprecation hunting, and I think that is a reasonable approach since we won't usually be able catch this ourselves.
Something to think about as well: Possibly we put together a production log parsing script that we can take user submitted logs and spend some time looking for deprecation warnings as well that crop up. Maybe filters on uniqueness and uses counts?
@@ -19,7 +19,7 @@ | |||
# Don't care if the mailer can't send | |||
config.action_mailer.raise_delivery_errors = false | |||
|
|||
# Print deprecation notices to the Rails logger | |||
# Print deprecation notices to the Rails logger. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Man, this line is SUPER important!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Man, this line is SUPER important!
Period.
@@ -10,8 +10,8 @@ | |||
config.cache_classes = true | |||
config.eager_load = false | |||
|
|||
# Print deprecation notices to the stderr | |||
#ActiveSupport::Deprecation.behavior = :stderr | |||
# Print deprecation notices to the stderr. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, extremely important!
@NickLaMuro I used this for the logs generated from QE: It's not perfect but grouped enough of them together to get a decent idea of how many times it happens. |
That works, though this got me thinking: Does this make sense as something that runs as an after task in CI as well, and then we can hook it into the Again, just tossing some ideas out there for consideration. Not in anyway something that needs to be actionable right now. |
Change from rails :notify default since it's unlikely we'll have users setup notifications for deprecation warnings.