firewall: add request logger disable flag#1216
Conversation
|
@claude review this |
Summary of ChangesHello @ellemouton, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new configuration option to completely disable the firewall's request logger. This is primarily aimed at improving performance by allowing the system to bypass all logging overhead, including interceptor processing and database writes, when logging is not required. It also includes a crucial validation to prevent a misconfiguration where the Autopilot feature, which depends on these logs, might be active while logging is disabled. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Claude finished @ellemouton's task in 54s —— View job Code ReviewI've reviewed the changes in this PR. Overall, the implementation looks solid and correctly addresses the goal of providing a way to completely disable request logging. Here are my findings: Positive Observations
Issues and Suggestions1. Misleading error message (terminal.go:1182) The error message return fmt.Errorf("error creating new request logger")Suggestion: Include the error context: return fmt.Errorf("error creating new request logger: %w", err)2. Typo in existing code (terminal.go:1553) While not introduced by this PR, there's a typo in the error message: This could be fixed in a follow-up, but since you're already touching firewall-related code, it might be worth including. 3. Missing test coverage The PR doesn't appear to include tests for the new validation logic. Consider adding tests for:
4. Configuration default clarity The Minor Observations
SummaryThis is a well-implemented feature with good design decisions. The main issue is the missing error wrapping in the error message, which should be fixed. The validation logic correctly prevents misconfiguration, and the performance optimization approach is sound. Recommendation: Fix the error message wrapping, consider adding tests, and this will be ready to merge. |
There was a problem hiding this comment.
Code Review
This pull request introduces a new configuration flag to disable the firewall's request logger, which is a useful performance optimization. The implementation correctly handles the conditional instantiation of the logger and its associated components. The added validation to ensure autopilot is disabled when the logger is off is a crucial safeguard. The code is well-structured and the changes are clearly explained. I have one minor suggestion to improve error wrapping, which will enhance debuggability.
terminal.go
Outdated
| g.cfg.Firewall.RequestLogger, g.stores.firewall, | ||
| ) | ||
| if err != nil { | ||
| return fmt.Errorf("error creating new request logger") |
There was a problem hiding this comment.
For better error diagnostics, it's a good practice to wrap the original error. This provides more context when debugging issues related to the request logger creation.
| return fmt.Errorf("error creating new request logger") | |
| return fmt.Errorf("error creating new request logger: %w", err) |
de5ce70 to
10525b3
Compare
ViktorT-11
left a comment
There was a problem hiding this comment.
Generally looks great! Just adding a few notes below.
Also, I think we should add itest coverage for this new behaviour as well. I've prepared a test locally (which depends on the config validation fix mentioned below).
I can push to this PR if you'd like :)?
|
thanks @ViktorT-11 🙏 yes, feel free to push your diffs from your branch! |
95be438 to
a1a066c
Compare
ViktorT-11
left a comment
There was a problem hiding this comment.
@ellemouton, I force pushed some changes to this PR. Let me know if you think they look good :)
This introduces a new firewall.request-logger.disable config option to completely disable request logging. When disabled, the request logger interceptor is not instantiated, avoiding all logging overhead including database writes and request processing. This is implemented as a separate disable flag rather than adding a new log level because the goal is to bypass the logging system entirely for performance reasons, not just filter events. A log level would still process and filter each request through the interceptor. The change also adds validation to ensure autopilot remains enabled only when request logging is active, since autopilot relies on action logs for rule enforcement and auditing.
a1a066c to
996127b
Compare
|
looks good 🙏 nice itest! |
|
Thanks 🎉!
Yes sorry about that 😞. As I needed to remove stuff from the first commit to split out the release docs from the commit, I noticed now that splitting that commit removed you as the author. I then fixed up the actual release docs commit, with the "second" split commit from the first commit, which resulted in me becoming the author for the second commit as well. I can try to fix that if you'd like? |
This introduces a new firewall.request-logger.disable config option to completely disable request logging. When disabled, the request logger interceptor is not instantiated, avoiding all logging overhead including database writes and request processing.
This is implemented as a separate disable flag rather than adding a new log level because the goal is to bypass the logging system entirely for performance reasons, not just filter events. A log level would still process and filter each request through the interceptor.
The change also adds validation to ensure autopilot remains enabled only when request logging is active, since autopilot relies on action logs for rule enforcement and auditing.