Skip to content

Conversation

@sususu98
Copy link
Contributor

Summary

Make the hardcoded error log retention limit (10 files) configurable via error-logs-max-files.

Changes

  • 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

Configuration

# Maximum number of error log files retained when request logging is disabled.
# When exceeded, the oldest error log files are deleted. Default is 10. Set to 0 to disable cleanup.
error-logs-max-files: 10

API

# Get current value
curl http://localhost:8317/v0/management/error-logs-max-files

# Update value (hot-reload supported)
curl -X PUT http://localhost:8317/v0/management/error-logs-max-files \
  -H "Content-Type: application/json" \
  -d '{"value": 20}'

- 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.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Configurable Error Log Retention: The maximum number of error log files to retain is now configurable via error-logs-max-files instead of being hardcoded to 10.
  • Hot-Reload Support: Changes to error-logs-max-files in the configuration file are now hot-reloaded without requiring a service restart.
  • Management API Endpoints: New GET/PUT/PATCH endpoints (/v0/management/error-logs-max-files) have been added to allow dynamic management of the error log retention setting.
  • SDK Enhancements: Introduced NewFileRequestLoggerWithOptions in the SDK for custom error log retention, while maintaining backward compatibility for NewFileRequestLogger.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

Comment on lines +238 to +240
if value < 0 {
value = 10
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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 = 10

Then, use it across the codebase, including here.

Suggested change
if value < 0 {
value = 10
}
if value < 0 {
value = config.DefaultErrorLogsMaxFiles
}

@luispater luispater merged commit 3b04e11 into router-for-me:dev Jan 31, 2026
2 checks passed
CreatorMetaSky pushed a commit to AIxSpace/CLIProxyAPI that referenced this pull request Feb 11, 2026
…-error-logs-max-files

feat(logging): make error-logs-max-files configurable
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.

2 participants