Skip to content

Refactor ThreadPoolStats.Stats with Builder pattern#19317

Merged
sandeshkr419 merged 1 commit intoopensearch-project:mainfrom
pado0:builder-threadpool-stats
Oct 22, 2025
Merged

Refactor ThreadPoolStats.Stats with Builder pattern#19317
sandeshkr419 merged 1 commit intoopensearch-project:mainfrom
pado0:builder-threadpool-stats

Conversation

@pado0
Copy link
Contributor

@pado0 pado0 commented Sep 17, 2025

Description

This PR refactors the ThreadPoolStats.Stats 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 IndexingStats.Stats as part of that effort.

Related Issues

Partially resolves #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 Sep 17, 2025
@pado0 pado0 marked this pull request as ready for review September 17, 2025 04:20
@github-actions
Copy link
Contributor

✅ Gradle check result for a75694d: SUCCESS

@codecov
Copy link

codecov bot commented Sep 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.10%. Comparing base (3ffa49a) to head (32ef22c).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19317      +/-   ##
============================================
+ Coverage     73.07%   73.10%   +0.02%     
- Complexity    70741    70832      +91     
============================================
  Files          5732     5732              
  Lines        324140   324190      +50     
  Branches      46922    46922              
============================================
+ Hits         236853   236985     +132     
  Misses        68117    68117              
+ Partials      19170    19088      -82     

☔ 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 force-pushed the builder-threadpool-stats branch from b5ec9d0 to 8894339 Compare September 20, 2025 16:14
@github-actions
Copy link
Contributor

❌ Gradle check result for 8894339: 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 8894339: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

Copy link
Member

@sandeshkr419 sandeshkr419 left a comment

Choose a reason for hiding this comment

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

Can you please rebase with latest main, rest LGTM! Thanks!

@pado0 pado0 force-pushed the builder-threadpool-stats branch from 8894339 to 2e01531 Compare September 30, 2025 21:02
@github-actions
Copy link
Contributor

✅ Gradle check result for 2e01531: SUCCESS

@sandeshkr419
Copy link
Member

Looks like a lot of conflicts came in, rebase again?
(Sorry, I know this gets irritating at some point.)

@pado0 pado0 force-pushed the builder-threadpool-stats branch from 2e01531 to fde2ddd Compare October 21, 2025 05:00
@pado0
Copy link
Contributor Author

pado0 commented Oct 21, 2025

Looks like a lot of conflicts came in, rebase again? (Sorry, I know this gets irritating at some point.)

No worries! Thanks for keeping an eye on it. I’ve been checking things regularly and looking through other issues and code as well. Hope it gets merged soon :)

@pado0 pado0 force-pushed the builder-threadpool-stats branch from fde2ddd to bcb5719 Compare October 21, 2025 05:10
@github-actions
Copy link
Contributor

❌ Gradle check result for bcb5719: 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?

@pado0 pado0 closed this Oct 21, 2025
@pado0 pado0 reopened this Oct 21, 2025
@github-actions
Copy link
Contributor

❌ Gradle check result for bcb5719: 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?

@pado0 pado0 closed this Oct 21, 2025
@pado0 pado0 reopened this Oct 21, 2025
@github-actions
Copy link
Contributor

❌ Gradle check result for bcb5719: 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>
@pado0 pado0 force-pushed the builder-threadpool-stats branch from bcb5719 to 32ef22c Compare October 21, 2025 22:01
@github-actions
Copy link
Contributor

✅ Gradle check result for 32ef22c: SUCCESS

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