-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add verbose pipeline parameter to output each processor's execution details #16843
base: main
Are you sure you want to change the base?
Add verbose pipeline parameter to output each processor's execution details #16843
Conversation
…etails Signed-off-by: Junwei Dai <[email protected]>
Signed-off-by: Junwei Dai <[email protected]>
d5a2c4c
to
d931750
Compare
Signed-off-by: Junwei Dai <[email protected]>
@joshpalis Hey Josh, can you take a look when you have time? :) |
Signed-off-by: Junwei Dai <[email protected]>
❌ Gradle check result for 488377f: 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? |
❌ Gradle check result for 719fa1c: 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: Junwei Dai <[email protected]>
719fa1c
to
e4e30f5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @junweid62 on implementing this feature. A few comments from my initial pass
server/src/main/java/org/opensearch/search/internal/InternalSearchResponse.java
Show resolved
Hide resolved
❌ Gradle check result for e4e30f5: 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: Junwei Dai <[email protected]>
❕ Gradle check result for 615a4b6: 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. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #16843 +/- ##
============================================
+ Coverage 72.03% 72.04% +0.01%
- Complexity 65230 65238 +8
============================================
Files 5318 5319 +1
Lines 304051 304224 +173
Branches 43990 44022 +32
============================================
+ Hits 219021 219187 +166
- Misses 67121 67134 +13
+ Partials 17909 17903 -6 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Junwei Dai <[email protected]>
820849b
to
0ae4d06
Compare
❌ Gradle check result for 0ae4d06: 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? |
Hi, @dbwiddis Could you please take a moment to review this PR when you have the time? I’d appreciate any feedback you might have :) |
@@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | |||
- Add new configuration setting `synonym_analyzer`, to the `synonym` and `synonym_graph` filters, enabling the specification of a custom analyzer for reading the synonym file ([#16488](https://github.com/opensearch-project/OpenSearch/pull/16488)). | |||
- Add stats for remote publication failure and move download failure stats to remote methods([#16682](https://github.com/opensearch-project/OpenSearch/pull/16682/)) | |||
- Added a precaution to handle extreme date values during sorting to prevent `arithmetic_exception: long overflow` ([#16812](https://github.com/opensearch-project/OpenSearch/pull/16812)). | |||
- Add `verbose_pipeline` parameter to output each processor's execution details ([#14745](https://github.com/opensearch-project/OpenSearch/pull/14745)). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link has to point to PR #16843, current one is for the issue
@@ -302,6 +305,9 @@ public SearchSourceBuilder(StreamInput in) throws IOException { | |||
if (in.getVersion().onOrAfter(Version.V_2_18_0)) { | |||
searchPipeline = in.readOptionalString(); | |||
} | |||
if (in.getVersion().onOrAfter(Version.CURRENT)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to have exact version here, CURRENT will change with every next release
@@ -385,6 +391,9 @@ public void writeTo(StreamOutput out) throws IOException { | |||
if (out.getVersion().onOrAfter(Version.V_2_18_0)) { | |||
out.writeOptionalString(searchPipeline); | |||
} | |||
if (out.getVersion().onOrAfter(Version.CURRENT)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as in previous comment
return this; | ||
} | ||
|
||
public Boolean verbosePipeline() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why return type is a wrapper around primitive Boolean?
|
||
private static void writeProcessorResultOnOrAfter(StreamOutput out, List<ProcessorExecutionDetail> processorResult) throws IOException { | ||
if (out.getVersion().onOrAfter(Version.V_2_18_0)) { | ||
out.writeCollection(processorResult, (o, detail) -> detail.writeTo(o)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to Josh's comment, please use out.writeList()
@@ -146,11 +147,18 @@ void transformRequest(SearchRequest request, ActionListener<SearchRequest> reque | |||
final ActionListener<SearchRequest> nextListener = currentListener; | |||
SearchRequestProcessor processor = searchRequestProcessors.get(i); | |||
currentListener = ActionListener.wrap(r -> { | |||
ProcessorExecutionDetail detail = new ProcessorExecutionDetail(processor.getType()); | |||
detail.addInput(r.source().shallowCopy()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add check for verbosePipeline
here, we're adding unnecessary overhead of doing shallow copy in case verbose is not enabled
@@ -225,11 +241,19 @@ ActionListener<SearchResponse> transformResponseListener( | |||
final SearchResponseProcessor processor = searchResponseProcessors.get(i); | |||
|
|||
responseListener = ActionListener.wrap(r -> { | |||
ProcessorExecutionDetail detail = new ProcessorExecutionDetail(processor.getType()); | |||
detail.addInput(Arrays.asList(r.getHits().deepCopy().getHits())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to spend cycles on doing shallow copy only in case verbose flag is set, please consider making corresponding changes
attributes.computeIfAbsent(PROCESSOR_EXECUTION_DETAILS_KEY, k -> new ArrayList<ProcessorExecutionDetail>()); | ||
List<ProcessorExecutionDetail> details = (List<ProcessorExecutionDetail>) attributes.get(PROCESSOR_EXECUTION_DETAILS_KEY); | ||
details.add(detail); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few extra cycles here for accessing map, how about this version:
public void addProcessorExecutionDetail(ProcessorExecutionDetail detail) {
@SuppressWarnings("unchecked")
List<ProcessorExecutionDetail> details = (List<ProcessorExecutionDetail>) attributes.computeIfAbsent(
PROCESSOR_EXECUTION_DETAILS_KEY,
k -> new ArrayList<>()
);
details.add(detail);
}
Description
Related RFC : #16705
This PR introduces enhancements to OpenSearch's search pipeline functionality, focusing on improving the traceability and debugging of search request and response transformations. It addresses the increasing complexity of search pipeline processors by implementing verbose mode support, which provides detailed insights into processor execution.
Adds Verbose Mode for Search Pipelines:
verbose_pipeline
parameter to search requests, default to false.Improves Pipeline Debugging:
Supports All Pipeline Configurations:
Test Framework Enhancements:
Example output with request processor:
filter_query
response processor:rename_field
andsort
Related Issues
Resolves #14745
Check List
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.