Skip to content

Conversation

@pado0
Copy link
Contributor

@pado0 pado0 commented Nov 16, 2025

Description

This PR refactors the Cache.CacheStats class to use the Builder pattern instead of relying on multiple constructors.

By adopting the Builder pattern, it becomes easier to evolve the stats API, add new metrics, and maintain backward compatibility without forcing disruptive constructor changes.

Based on the related issue:

  1. Added a Builder and deprecated the existing constructors.
  2. Replaced usages of constructors in code and tests with the new Builder.

There are multiple stats-related classes that need similar refactoring, and we are addressing them in priority order. This PR covers Cache.CacheStats as part of that effort.

Related Issues

Related to #19225

Check List

  • Functionality includes testing.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@pado0 pado0 marked this pull request as ready for review November 16, 2025 08:45
@pado0 pado0 requested a review from a team as a code owner November 16, 2025 08:45
@github-actions
Copy link
Contributor

❌ Gradle check result for 053cfad: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

❌ Gradle check result for 053cfad: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

❌ Gradle check result for 053cfad: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

❌ Gradle check result for 053cfad: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

❌ Gradle check result for 053cfad: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

❌ Gradle check result for 053cfad: null

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

❌ Gradle check result for 053cfad: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Jean Kim <bgshhd95@gmail.com>
Signed-off-by: Jean Kim <bgshhd95@gmail.com>
@pado0 pado0 force-pushed the builder-cache-cashStats branch from 053cfad to 04715a0 Compare November 18, 2025 21:51
@github-actions github-actions bot added enhancement Enhancement or improvement to existing feature or request good first issue Good for newcomers Indexing Indexing, Bulk Indexing and anything related to indexing Other Search Search query, autocomplete ...etc labels Nov 18, 2025
@github-actions
Copy link
Contributor

❌ Gradle check result for 04715a0: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions
Copy link
Contributor

✅ Gradle check result for 04715a0: SUCCESS

@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.18%. Comparing base (2f930dc) to head (04715a0).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #20015      +/-   ##
============================================
- Coverage     73.24%   73.18%   -0.06%     
+ Complexity    71519    71502      -17     
============================================
  Files          5789     5789              
  Lines        327121   327137      +16     
  Branches      47117    47117              
============================================
- Hits         239591   239424     -167     
- Misses        68269    68500     +231     
+ Partials      19261    19213      -48     

☔ 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.

@sandeshkr419 sandeshkr419 merged commit 476a0e2 into opensearch-project:main Nov 19, 2025
34 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement or improvement to existing feature or request good first issue Good for newcomers Indexing Indexing, Bulk Indexing and anything related to indexing Other Search Search query, autocomplete ...etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Refactor] Use Builder pattern instead of constructors for Stats API classes

2 participants