Skip to content

Conversation

@pado0
Copy link
Contributor

@pado0 pado0 commented Sep 16, 2025

Description

This PR refactors the IndexingStats.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 16, 2025
@pado0 pado0 force-pushed the builder-indexing-stats branch from 61caf20 to e7609b4 Compare September 16, 2025 04:33
@pado0 pado0 marked this pull request as ready for review September 16, 2025 04:34
@github-actions
Copy link
Contributor

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

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.

Thanks @pado0 for working on the changes. The changes look good overall, few comments:


I see you ran into spotless (indenting) failures.
Run ./gradlew :server:spotlessApply to fix these violations and then commit the changes again.


Add a changelog. Refer: https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md


nit: mentioning Resolves <any issue> closes the issue once the PR is merged. For changes which are partially resolving the issue, mention Partially resolves <any issue> to keep the primary issue open. Not something to worry about but I thought to mention it anyway.

@pado0 pado0 force-pushed the builder-indexing-stats branch from 3259b90 to a251ef2 Compare September 17, 2025 02:55
@pado0 pado0 reopened this Sep 30, 2025
@github-actions
Copy link
Contributor

✅ Gradle check result for f9c10a9: SUCCESS

@github-actions
Copy link
Contributor

✅ Gradle check result for 3e3fddd: SUCCESS

@pado0 pado0 force-pushed the builder-indexing-stats branch from 3e3fddd to 2c958be Compare October 20, 2025 05:10
@github-actions
Copy link
Contributor

❌ Gradle check result for 2c958be: 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 20, 2025
@pado0 pado0 reopened this Oct 20, 2025
@github-actions
Copy link
Contributor

❌ Gradle check result for 2c958be: 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-indexing-stats branch 3 times, most recently from b4fec34 to b10ecf2 Compare October 21, 2025 05:09
@github-actions
Copy link
Contributor

❌ Gradle check result for b10ecf2: 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
@sandeshkr419
Copy link
Member

@peterzhuamazon @gaiksaya Is there a pending change in main causing builds to break?

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':distribution:bwc:minor:buildBwcLinuxTar'.
> Building 3.3.0 didn't generate expected file /var/jenkins/workspace/gradle-check/search/distribution/bwc/minor/build/bwc/checkout-3.3/distribution/archives/linux-tar/build/distributions/opensearch-min-3.3.0-SNAPSHOT-linux-x64.tar.gz

@github-actions
Copy link
Contributor

❌ Gradle check result for b10ecf2: 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-indexing-stats branch from b10ecf2 to 1d6a88d Compare October 21, 2025 22:02
@github-actions
Copy link
Contributor

❌ Gradle check result for 1d6a88d: 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-indexing-stats branch from 1d6a88d to 3ef8c9a Compare October 22, 2025 03:48
@github-actions
Copy link
Contributor

✅ Gradle check result for 3ef8c9a: 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

3 participants