Skip to content
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

[Discover] fix error handling in query enhancement facet #8743

Merged
merged 2 commits into from
Oct 29, 2024

Conversation

joshuali925
Copy link
Member

Description

In query enhancements facet, the fetch errors are caught and returned as

{ success: false, data: Error }

} catch (err: any) {
this.logger.error(`Facet fetch: ${endpoint}: ${err}`);
return {
success: false,
data: err,
};
}

} catch (err: any) {
this.logger.error(`Facet fetch: ${endpoint}: ${err}`);
return {
success: false,
data: err,
};
}

But describeQuery is not checking if success is true, and will process the Error object as IPPLEventsDataSource or IPPLVisualizationDataSource, causing internal server error.

jdbc: (data: any) => shimSchemaRow(data as IPPLEventsDataSource),
viz: (data: any) => shimStats(data as IPPLVisualizationDataSource),

@kavilla @mengweieric @ps48 let me know if this is not a good fix

Issues Resolved

Screenshot

Testing the changes

Changelog

  • fix: fix error handling in query enhancement facet

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@kavilla kavilla added discover for discover reinvent discover-next labels Oct 29, 2024
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 60.75%. Comparing base (c66b698) to head (6dd9ad6).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/plugins/query_enhancements/common/utils.ts 0.00% 2 Missing ⚠️
...c/plugins/query_enhancements/server/utils/facet.ts 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8743   +/-   ##
=======================================
  Coverage   60.75%   60.75%           
=======================================
  Files        3798     3798           
  Lines       90682    90683    +1     
  Branches    14271    14271           
=======================================
+ Hits        55092    55094    +2     
+ Misses      32093    32092    -1     
  Partials     3497     3497           
Flag Coverage Δ
Linux_1 29.06% <ø> (ø)
Linux_2 56.39% <ø> (ø)
Linux_3 37.60% <ø> (ø)
Linux_4 29.83% <0.00%> (+<0.01%) ⬆️
Windows_1 29.07% <ø> (ø)
Windows_2 56.34% <ø> (ø)
Windows_3 37.60% <ø> (ø)
Windows_4 29.82% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ananzh ananzh merged commit 2f31914 into opensearch-project:main Oct 29, 2024
75 of 76 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 29, 2024
* [Discover] fix error handling in query enhancement facet

---------

Signed-off-by: Joshua Li <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 2f31914)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Qxisylolo pushed a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Oct 30, 2024
…project#8743)

* [Discover] fix error handling in query enhancement facet

---------

Signed-off-by: Joshua Li <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
AMoo-Miki pushed a commit that referenced this pull request Oct 30, 2024
* [Discover] fix error handling in query enhancement facet

---------



(cherry picked from commit 2f31914)

Signed-off-by: Joshua Li <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
amsiglan pushed a commit to amsiglan/OpenSearch-Dashboards that referenced this pull request Nov 1, 2024
…project#8743)

* [Discover] fix error handling in query enhancement facet

---------

Signed-off-by: Joshua Li <[email protected]>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants