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

[Obs AI Assistant] Show error toast on failure #179335

Merged

Conversation

miltonhultgren
Copy link
Contributor

@miltonhultgren miltonhultgren commented Mar 25, 2024

If the call to ObservabilityAIAssistantAppService.start fails, show an error toast to notify the user.

Screenshot 2024-03-25 at 12 23 46

@miltonhultgren miltonhultgren added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) Team:obs-knowledge Observability Experience Knowledge team labels Mar 25, 2024
@miltonhultgren miltonhultgren requested a review from a team as a code owner March 25, 2024 11:23
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-knowledge-team (Team:obs-knowledge)

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • /oblt-deploy-serverless : Deploy a serverless Kibana instance using the Observability test environments.
  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@@ -41,6 +42,19 @@ export function NavControl({}: {}) {
[service, hasBeenOpened]
);

useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

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

is L39 not a better place to handle it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because useAbortableAsync doesn't bubble the error up from the Promise creation function, it sets it as part of the state of the hook and returns it (same as for .value).

Copy link
Member

Choose a reason for hiding this comment

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

you can add a catch handler before the value is returned though, e.g. service.start({ signal }).catch(notifyError)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 60dea26

Copy link
Member

Choose a reason for hiding this comment

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

I would have to look at the code to see what you're doing. In your latest change, you'll want to rethrow the error after creating the notification, otherwise it looks like it actually succeeded

Copy link
Contributor Author

Choose a reason for hiding this comment

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

return hasBeenOpened
? service.start({ signal }).catch((error) => {
notifications.toasts.addError(error, {
title: 'Failed to initialize Observability AI Assistant',
Copy link
Member

Choose a reason for hiding this comment

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

i18n?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
observabilityAIAssistantApp 140.4KB 140.6KB +237.0B

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@miltonhultgren miltonhultgren merged commit 184846c into elastic:main Mar 25, 2024
16 checks passed
@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.13 Backport failed because of merge conflicts

You might need to backport the following PRs to 8.13:
- [Security Solution][Rule Management] Getting rid off before hook if is not loading an archive (#178891)

Manual backport

To create the backport manually run:

node scripts/backport --pr 179335

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 26, 2024
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 179335 locally

@miltonhultgren miltonhultgren removed the backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) label Mar 27, 2024
@kibanamachine kibanamachine added backport:skip This commit does not require backporting and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:obs-knowledge Observability Experience Knowledge team v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants