-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(logging): make error-logs-max-files configurable #1368
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
feat(logging): make error-logs-max-files configurable #1368
Conversation
- Add ErrorLogsMaxFiles config field with default value 10 - Support hot-reload via config file changes - Add Management API: GET/PUT/PATCH /v0/management/error-logs-max-files - Maintain SDK backward compatibility with NewFileRequestLogger (3 params) - Add NewFileRequestLoggerWithOptions for custom error log retention When request logging is disabled, forced error logs are retained up to the configured limit. Set to 0 to disable cleanup.
Summary of ChangesHello @sususu98, 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 significant improvement to the error logging mechanism by making the retention policy configurable. Previously, the system hardcoded the retention of error log files to a maximum of 10. This change externalizes this setting, allowing users to define their desired maximum number of error log files through a configuration parameter, via hot-reload, or through new management API endpoints. This enhances flexibility and control over log management, especially in environments with varying storage or compliance requirements. 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
|
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.
Code Review
This pull request introduces a configurable limit for error log file retention, which was previously hardcoded. The changes are well-implemented, including the addition of a new configuration option, a management API for hot-reloading, and backward compatibility for the SDK.
My review includes one suggestion to replace the hardcoded default value for error-logs-max-files with a constant to improve code maintainability and consistency across the application.
| if value < 0 { | ||
| value = 10 | ||
| } |
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.
The default value 10 is hardcoded here. This value is also used as a default and for validation in internal/config/config.go (lines 509 and 559). To improve maintainability and consistency, consider defining this as a shared constant.
I recommend adding an exported constant in the internal/config package:
// internal/config/config.go
const DefaultErrorLogsMaxFiles = 10Then, use it across the codebase, including here.
| if value < 0 { | |
| value = 10 | |
| } | |
| if value < 0 { | |
| value = config.DefaultErrorLogsMaxFiles | |
| } |
…-error-logs-max-files feat(logging): make error-logs-max-files configurable
Summary
Make the hardcoded error log retention limit (10 files) configurable via
error-logs-max-files.Changes
ErrorLogsMaxFilesconfig field with default value 10GET/PUT/PATCH /v0/management/error-logs-max-filesNewFileRequestLogger(3 params)NewFileRequestLoggerWithOptionsfor custom error log retentionConfiguration
API