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

Add option to suppress deprecated warning logs. #37407

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

vamshi177
Copy link
Contributor

Commit Message: Add option to suppress deprecated warning logs.
Additional Description:
This commit introduces a new command-line option --suppress-deprecated-warning-logs that allows users to suppress log messages related to deprecated fields during Protobuf message validation. When enabled, Envoy will no longer log warnings for deprecated fields, which is useful for reducing log verbosity in production environments. By default, deprecated field warnings are logged as usual.
Risk Level: Low
Testing: The new option was verified by running Envoy with a static configuration file. When --suppress-deprecated-warning-logs was enabled, deprecated warning messages were suppressed from the logs, as expected. Tests also confirm correct log behavior when the option is toggled.

Docs Changes: yes
Release Notes: yes
Fixes: Addresses issue of reducing log verbosity in production environments as discussed at #37134

Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @wbpcode
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #37407 was opened by vamshi177.

see: more, trace.

@vamshi177
Copy link
Contributor Author

/retest

@wbpcode
Copy link
Member

wbpcode commented Dec 6, 2024

/lgtm api

Copy link
Contributor

@adisuissa adisuissa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!
A high-level comment: I sometimes wonder whether it is better to have a bootstrap knob to set these kinds of configurations (instead of a CLI option). The reason is that it may be easier to have a consistent config tracked in a file rather than in a CLI argument. The downside is probably that this feature may not kick in until the bootstrap was validated, and deprecated messages would have been spitted out. I'm good with the current proposal, just raising something to think about.
Leaving it up to @wbpcode to decide as a senior-maintainer.

@@ -40,6 +40,7 @@ struct FieldValidationConfig {
bool allow_unknown_static_fields = false;
bool reject_unknown_dynamic_fields = false;
bool ignore_unknown_dynamic_fields = false;
bool suppress_deprecated_warning_logs = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is being used, and can probably be removed (the call in server.cc can be with false).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the suppress_deprecated_warning_logs variable and directly updated the call in server.cc with false.

@@ -64,6 +65,7 @@ class MockOptions : public Options {
bool allow_unknown_static_fields_{};
bool reject_unknown_dynamic_fields_{};
bool ignore_unknown_dynamic_fields_{};
bool suppress_deprecated_warning_logs_{};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is being used, and can probably be removed (the default return value of the mock can be false, and a test can override it if needed).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed this variable and directly updated the mock to return false.

@ramaraochavali
Copy link
Contributor

The downside is probably that this feature may not kick in until the bootstrap was validated, and deprecated messages would have been spitted out. I'm good with the current proposal, just raising something to think about.

We initially considered bootstrap option but pivoted to command line for the exact reason that you mentioned.

@vamshi177
Copy link
Contributor Author

Thanks for the initial review. I have updated the tests based on the comments.
@adisuissa or @wbpcode could I get a review on this change again?

Comment on lines 128 to 129
// See :option:`--suppress-deprecated-warning-logs` for details.
bool suppress_deprecated_warning_logs = 41;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for this contribution. I am good to the implementation and code. But I personally prefer short command line option name at the precondition that without compromising the meaning.

So, I will prefer no_deprecated_warning or someting. WDYT?

/wait-any

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about skip_deprecated_logs ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review.
will update the command line option to more shorter name like skip_deprecated_logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the code with a shorter command line option skip_deprecated_logs that retains the same meaning.

@vamshi177
Copy link
Contributor Author

/retest

wbpcode
wbpcode previously approved these changes Jan 8, 2025
Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@repokitteh-read-only repokitteh-read-only bot removed the api label Jan 8, 2025
@wbpcode
Copy link
Member

wbpcode commented Jan 8, 2025

Could merge main and resolve the conflicts? Thanks.

@vamshi177
Copy link
Contributor Author

/retest

@repokitteh-read-only repokitteh-read-only bot removed the api label Jan 9, 2025
@wbpcode
Copy link
Member

wbpcode commented Jan 9, 2025

cc @adisuissa

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

Successfully merging this pull request may close these issues.

4 participants