Skip to content

Conversation

@pado0
Copy link
Contributor

@pado0 pado0 commented Nov 1, 2025

Description

This PR refactors the DocStats and StoreStats 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 DocStats and StoreStats 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.

@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 1, 2025
Signed-off-by: Jean Kim <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

✅ Gradle check result for 778f5c0: SUCCESS

@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

❌ Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 73.15%. Comparing base (6b35c7c) to head (778f5c0).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...in/java/org/opensearch/index/store/StoreStats.java 92.85% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19863      +/-   ##
============================================
+ Coverage     73.08%   73.15%   +0.06%     
- Complexity    71063    71120      +57     
============================================
  Files          5754     5754              
  Lines        325262   325292      +30     
  Branches      47033    47034       +1     
============================================
+ Hits         237732   237965     +233     
+ Misses        68380    68216     -164     
+ Partials      19150    19111      -39     

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

@pado0 pado0 requested a review from a team as a code owner November 2, 2025 23:05
@sandeshkr419 sandeshkr419 merged commit dc9c1b3 into opensearch-project:main Nov 3, 2025
57 checks passed
anandpatel9998 pushed a commit to anandpatel9998/OpenSearch that referenced this pull request Nov 3, 2025
…ject#19863)

* Add Builder in DocStats and refactor usage

Signed-off-by: Jean Kim <[email protected]>

* Add Builder in StoreStats and refactor usage

Signed-off-by: Jean Kim <[email protected]>

* Add Change Log

Signed-off-by: Jean Kim <[email protected]>

---------

Signed-off-by: Jean Kim <[email protected]>
@pado0 pado0 deleted the builder-doc-store-stats branch November 8, 2025 22:02
liuguoqingfz pushed a commit to liuguoqingfz/OpenSearch that referenced this pull request Dec 15, 2025
…ject#19863)

* Add Builder in DocStats and refactor usage

Signed-off-by: Jean Kim <[email protected]>

* Add Builder in StoreStats and refactor usage

Signed-off-by: Jean Kim <[email protected]>

* Add Change Log

Signed-off-by: Jean Kim <[email protected]>

---------

Signed-off-by: Jean Kim <[email protected]>
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

3 participants