Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

Implemented percentage-based sizing for stat-cache and type-cache. Added robust memory detection for containers.


PR created automatically by Jules for task 17655415470044514907 started by @gargnitingoogle

Added two new configuration flags:
- `metadata-cache:stat-cache-max-size-percent`
- `metadata-cache:type-cache-max-size-percent`

These allow specifying the cache size as a percentage of the total available system memory. When specified (value > 0), they calculate the corresponding size in MB (based on container memory limits or physical memory) and overwrite the `stat-cache-max-size-mb` and `type-cache-max-size-mb` configurations.

Implemented `internal/util/GetTotalMemory` to robustly detect memory limits, supporting Cgroup v1 and v2 for containerized environments.
Updated `cfg/rationalize.go` to handle the precedence logic.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@github-actions
Copy link

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Support percentage-based sizing for metadata caches". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

Added two new configuration flags:
- `metadata-cache:stat-cache-max-size-percent`
- `metadata-cache:type-cache-max-size-percent`

These allow specifying the cache size as a percentage of the total available system memory. When specified (value > 0), they calculate the corresponding size in MB (based on container memory limits or physical memory) and overwrite the `stat-cache-max-size-mb` and `type-cache-max-size-mb` configurations.

Implemented `internal/util/GetTotalMemory` to robustly detect memory limits, supporting Cgroup v1 and v2 for containerized environments.
Updated `cfg/rationalize.go` to handle the precedence logic.
Formatted the code using `go fmt`.
@codecov
Copy link

codecov bot commented Dec 22, 2025

Codecov Report

❌ Patch coverage is 9.33333% with 68 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.85%. Comparing base (d030570) to head (879875f).

Files with missing lines Patch % Lines
internal/util/mem_info.go 0.00% 50 Missing ⚠️
cfg/rationalize.go 28.00% 14 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4184      +/-   ##
==========================================
- Coverage   83.19%   82.85%   -0.34%     
==========================================
  Files         153      154       +1     
  Lines       18716    18791      +75     
==========================================
  Hits        15570    15570              
- Misses       2577     2646      +69     
- Partials      569      575       +6     
Flag Coverage Δ
unittests 82.85% <9.33%> (-0.34%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Added two new configuration flags:
- `metadata-cache:stat-cache-max-size-percent`
- `metadata-cache:type-cache-max-size-percent`

These allow specifying the cache size as a percentage of the total available system memory. When specified (value > 0), they calculate the corresponding size in MB (based on container memory limits or physical memory) and overwrite the `stat-cache-max-size-mb` and `type-cache-max-size-mb` configurations.

Implemented `internal/util/GetTotalMemory` to robustly detect memory limits, supporting Cgroup v1 and v2 for containerized environments.
Updated `cfg/rationalize.go` to handle the precedence logic.
Formatted the code using `go fmt`.
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.

0 participants