-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Is your feature request related to a problem? Please describe
As a follow-up on #18723, I noticed other stats related classes should also utilize Builder pattern to initialize stats objects.
For example IndexingStats currently has 2 constructors: https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/index/shard/IndexingStats.java#L191-L246
Stats related classes are exposed as PublicApi, and stats are frequently (or maybe once in a while but need to be) incremented, which causes backward-compatibility to break. This makes it difficult to add new metrics and evolve the API without causing significant disruption for developers who have adopted it. Each new stat forces a major version bump and requires users to update their code, even if they don't need the new metric.
Using this issue to track all such metric/stats classes to adopt to builder pattern and mark the existing public constructors to be on deprecation path.
Reference from SearchStats: #18707
Describe the solution you'd like
- List down all classes to be actioned from stats API / code dive deep
- Create builder pattern for those classes
- Mark existing constructors as deprecated
Related component
Other
Describe alternatives you've considered
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status