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

Fix error message display issue in dev tool console #3652

Merged
merged 5 commits into from
Mar 27, 2023

Conversation

zhongnansu
Copy link
Member

@zhongnansu zhongnansu commented Mar 22, 2023

Description

  • Fix error message display issue in dev tool console

Updated screenshot

image

Previous screenshot

image

Issues Resolved

#3645

Check List

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

@zhongnansu zhongnansu requested a review from a team as a code owner March 22, 2023 20:49
Signed-off-by: Su <szhongna@amazon.com>
@codecov-commenter
Copy link

codecov-commenter commented Mar 22, 2023

Codecov Report

Merging #3652 (b2d90c8) into main (de06344) will decrease coverage by 0.05%.
The diff coverage is 40.00%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main    #3652      +/-   ##
==========================================
- Coverage   66.45%   66.41%   -0.05%     
==========================================
  Files        3208     3209       +1     
  Lines       61593    61610      +17     
  Branches     9502     9504       +2     
==========================================
- Hits        40932    40916      -16     
- Misses      18384    18413      +29     
- Partials     2277     2281       +4     
Flag Coverage Δ
Linux ?
Windows 66.41% <40.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
.../server/routes/api/console/proxy/create_handler.ts 74.35% <25.00%> (-2.57%) ⬇️
src/core/server/opensearch/client/errors.ts 100.00% <100.00%> (ø)

... and 9 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@abbyhu2000 abbyhu2000 self-assigned this Mar 22, 2023
@abbyhu2000 abbyhu2000 added the multiple datasource multiple datasource project label Mar 23, 2023
zengyan-amazon
zengyan-amazon previously approved these changes Mar 23, 2023
@kavilla
Copy link
Member

kavilla commented Mar 23, 2023

Hey @zhongnansu,

Thanks for handling this.

However, it still not quite formatted for readability and it dumps the error to the log whereas prior it did not. Would it possible to get it to feature parity ?

Signed-off-by: Su <szhongna@amazon.com>
@zhongnansu
Copy link
Member Author

@kavilla valid point, found a way to return exact error message as existing dev tool. Please take a look

CHANGELOG.md Outdated
@@ -209,6 +209,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Fixes management app breadcrumb error ([#2344](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2344))
- [BUG] Fix suggestion list cutoff issue ([#2607](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2607))
- [TSVB] Fixes undefined serial diff aggregation documentation link ([#3503](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3503))
- Fix error message display issue in dev tool console ([#3652](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3652))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this issue introduced with new dev tool change for MD? if so, assume previous version doesn't has such issue, do we still need to callout and add to changelog?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's introduced by the dev tool refactor PR, literally it's not even related to MD. It's a good point, previous version doesn't have issue. Currently it's only that each PR is mapped to at least one changelog.

Any thoughts? @kavilla @abbyhu2000

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, @seraphjiang is correct - if we're only fixing an unreleased bug, no need for a new changelog entry. In some cases we would maybe want to update the original changelog entry, but in this case, I'd just skip.

And when we generate the release notes, we'll want to do some additional cleanup and consolidation, so that all the MD entries are grouped and nicely formatted.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed change log item

Signed-off-by: Su <szhongna@amazon.com>
Signed-off-by: Su <szhongna@amazon.com>
@zhongnansu zhongnansu added the Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry label Mar 23, 2023
@kavilla
Copy link
Member

kavilla commented Mar 24, 2023

Hey @zhongnansu, looks a lot more human readable!

Are we able to resolve the issue with it outputting error logs?

For example, on 2.6 if you hit an exception you can check your OpenSearch Dashboards server logs and it does not output anything.

But for this I am seeing:

[error][console][plugins] ResponseError: index_not_found_exception: [index_not_found_exception] Reason: no such index [foobar]
    at onBody (/path/node_modules/@opensearch-project/opensearch/lib/Transport.js:403:23)
    at IncomingMessage.onEnd (/pathnode_modules/@opensearch-project/opensearch/lib/Transport.js:318:11)
    at IncomingMessage.emit (events.js:412:35)
    at IncomingMessage.emit (domain.js:475:12)
    at endReadableNT (internal/streams/readable.js:1333:12)
    at processTicksAndRejections (internal/process/task_queues.js:82:21) {
  meta: {
    body: { error: [Object], status: 404 },
    statusCode: 404,
    headers: {
      'x-opaque-id': '####',
      'content-type': 'application/json; charset=UTF-8',
      'content-length': '514'
    },
    meta: {
      context: null,
      request: [Object],
      name: 'opensearch-js',
      connection: [Object],
      attempts: 0,
      aborted: false
    }
  }
}

Signed-off-by: Su <szhongna@amazon.com>
@zhongnansu
Copy link
Member Author

zhongnansu commented Mar 24, 2023

@kavilla Make sense, since client side will get the error for the user query , no need to print at console server side.I removed the log line

Copy link
Member

@abbyhu2000 abbyhu2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhongnansu On 2.6, the console does not output anything, but when I ran this, i still get some error log output:

server log [19:41:05.242] [error][data][opensearch] [index_not_found_exception]: no such index [my-dql-sample2]

@zhongnansu
Copy link
Member Author

zhongnansu commented Mar 24, 2023

@zhongnansu On 2.6, the console does not output anything, but when I ran this, i still get some error log output:

server log [19:41:05.242] [error][data][opensearch] [index_not_found_exception]: no such index [my-dql-sample2]

That's because after the refactor, the query request is now going through client provided by routeHander in core. Similar as user render visualization/Discover, it will log the error in core and label it as [data][opensearch]. Fact is user did make a request to OpenSearch and failed, I don't see a issue with core side logging the error.

I don't think it's a blocking issue. But if you have concern around UX, you can open another issue for discuss, maybe also in UX repo? I suggest we move forward with this PR. Thanks for bring it up. @abbyhu2000

@@ -127,15 +129,22 @@ export const createHandler = ({
},
});
} catch (e: any) {
log.error(e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we don't want to log the error? It's good practice to have service logging the errors for analysis or troubleshooting.

Copy link
Member Author

@zhongnansu zhongnansu Mar 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are logging error by core->openesarch logger, but not by console logger. Because the error response will be forwarded to client(browser). No need to log 2 times

@zhongnansu zhongnansu removed the request for review from AMoo-Miki March 24, 2023 23:22
@abbyhu2000 abbyhu2000 merged commit 53047b6 into opensearch-project:main Mar 27, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 27, 2023
Fix error message display issue in dev tool console

When user sends request in the console and result in error, the console will output a customized error message.

Signed-off-by: Su <szhongna@amazon.com>
(cherry picked from commit 53047b6)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
abbyhu2000 pushed a commit that referenced this pull request Mar 27, 2023
Fix error message display issue in dev tool console

When user sends request in the console and result in error, the console will output a customized error message.


(cherry picked from commit 53047b6)

Signed-off-by: Su <szhongna@amazon.com>
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>
sikhote pushed a commit to sikhote/OpenSearch-Dashboards that referenced this pull request Apr 24, 2023
…ct#3652)

Fix error message display issue in dev tool console

When user sends request in the console and result in error, the console will output a customized error message.

Signed-off-by: Su <szhongna@amazon.com>
Signed-off-by: David Sinclair <david@sinclair.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x multiple datasource multiple datasource project Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry v2.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] custom error not display correctly after dev tool console refactoring
8 participants