Repository navigation
Fix ProfileScorer.getChildren() to expose wrapped scorer in scorer tree #20607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
owaiskazi19
merged 6 commits into
opensearch-project:main
from
martin-gaievski:fix-profiler-scorer-getchildren
Feb 18, 2026
+180
−10
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f343d74
Fix ProfileScorer.getChildren() to expose wrapped scorer in scorer tree
martin-gaievski d6d32d8
Changed approach to use new ScoreWrapper interface
martin-gaievski 4d80fde
Renamed interface to WrappedScorerAccessor, added unit test
martin-gaievski bdc0fe0
Improving tests, corrected changelog
martin-gaievski bc1d39e
Changed to generic interface ProfilingWrapper
martin-gaievski c8ee7ef
Adding ProfilingWrapper to ProfilingAggregator and ProfilingLeafBucke…
martin-gaievski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
server/src/main/java/org/opensearch/search/profile/query/ProfilingWrapper.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.search.profile.query; | ||
|
|
||
| import org.opensearch.common.annotation.PublicApi; | ||
|
|
||
| /** | ||
| * Generic interface for profiling wrappers that decorate search components with timing instrumentation | ||
| * while preserving access to the original (delegate) component. | ||
| * <p> | ||
| * When search profiling is enabled, OpenSearch wraps scorers, collectors, and other components in | ||
| * profiling decorators that are package-private. This interface provides a public contract for plugins | ||
| * to detect and unwrap such wrappers, accessing the underlying component without requiring reflection | ||
| * or knowledge of package-private implementation classes. | ||
| * <p> | ||
| * Example usage in a plugin to unwrap a profiled scorer: | ||
| * <pre>{@code | ||
| * if (scorer instanceof ProfilingWrapper) { | ||
| * Scorer delegate = ((ProfilingWrapper<Scorer>) scorer).getDelegate(); | ||
| * // access custom scorer methods on the delegate | ||
| * } | ||
| * }</pre> | ||
| * | ||
| * @param <T> the type of the wrapped component (e.g., {@link org.apache.lucene.search.Scorer}, | ||
| * {@link org.apache.lucene.search.Collector}) | ||
| * @opensearch.api | ||
| */ | ||
| @PublicApi(since = "3.6.0") | ||
| public interface ProfilingWrapper<T> { | ||
|
|
||
| /** | ||
| * Returns the underlying delegate component that this profiling wrapper decorates. | ||
| * | ||
| * @return the original component that was wrapped for profiling | ||
| */ | ||
| T getDelegate(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.