Skip to content

Conversation

@pado0
Copy link
Contributor

@pado0 pado0 commented Nov 14, 2025

Description

This PR refactors the IndexPressutreStats, DeviceStats and TransportStats 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 IndexPressutreStats, DeviceStats and TransportStats 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
Copy link
Contributor

❌ Gradle check result for bf1d0b9: 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 force-pushed the builder-indexpressure-device-transport branch from bf1d0b9 to cbf26b1 Compare November 14, 2025 17:06
@github-actions
Copy link
Contributor

✅ Gradle check result for cbf26b1: SUCCESS

@codecov
Copy link

codecov bot commented Nov 14, 2025

Codecov Report

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

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #19991      +/-   ##
============================================
+ Coverage     73.23%   73.26%   +0.02%     
- Complexity    71544    71604      +60     
============================================
  Files          5786     5786              
  Lines        327013   327161     +148     
  Branches      47284    47292       +8     
============================================
+ Hits         239498   239682     +184     
- Misses        68245    68260      +15     
+ Partials      19270    19219      -51     

☔ 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 5969a77 into opensearch-project:main Nov 14, 2025
38 of 49 checks passed
rgsriram pushed a commit to rgsriram/OpenSearch that referenced this pull request Dec 5, 2025
liuguoqingfz pushed a commit to liuguoqingfz/OpenSearch that referenced this pull request Dec 15, 2025
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.

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

2 participants