-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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] Suppress "Missing index" toasts #149625
Merged
jughosta
merged 43 commits into
elastic:main
from
jughosta:129020-inline-missing-index-error
Feb 14, 2023
Merged
Changes from 23 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
e4b39fe
[Discover] Suppress "Missing index" toasts
jughosta 5460f94
Merge branch 'main' into 129020-inline-missing-index-error
jughosta fa3e071
[Discover] Update the default message
jughosta dd6ccc3
[Discover] Handle switching data views too
jughosta eafced6
[Discover] Rename param
jughosta 4cc1910
[Discover] Fix another case
jughosta 6dc15f5
[Discover] Fix checks
jughosta dd1a27c
[Discover] Fix tests
jughosta 0a98ad9
Merge branch 'main' into 129020-inline-missing-index-error
jughosta d92cce3
Merge branch 'main' into 129020-inline-missing-index-error
jughosta a1b4780
[Discover] Add a test
jughosta 2b05940
Merge branch 'main' into 129020-inline-missing-index-error
jughosta 8f1e30e
Merge branch 'main' into 129020-inline-missing-index-error
jughosta 4c386d9
[Discover] Clean up redundant code
jughosta 4902725
[Discover] Update wording
jughosta a82fcbe
Merge branch 'main' into 129020-inline-missing-index-error
jughosta 07e3b6d
Merge branch 'main' into 129020-inline-missing-index-error
jughosta c176bbd
[Discover] Update wording
jughosta d7cb8dd
Update src/plugins/discover/public/application/main/components/no_res…
jughosta 8a3ab85
[Discover] Clean up translations
jughosta 55feb95
Merge remote-tracking branch 'origin/129020-inline-missing-index-erro…
jughosta 4ac71ab
Merge remote-tracking branch 'upstream/main' into 129020-inline-missi…
jughosta bfa2052
[Discover] Resolve conflicts with main
jughosta f6c09e0
Merge branch 'main' into 129020-inline-missing-index-error
jughosta 2ec2293
[Discover] Wrap with try/catch
jughosta 9b051f4
Merge branch 'main' into 129020-inline-missing-index-error
jughosta dc46db3
[Discover] Fix for tests
jughosta e317a65
Merge remote-tracking branch 'origin/129020-inline-missing-index-erro…
jughosta eeff695
Merge branch 'main' into 129020-inline-missing-index-error
mattkime bce9870
Merge branch 'main' into 129020-inline-missing-index-error
jughosta 10e3d8a
Merge branch 'main' into 129020-inline-missing-index-error
jughosta d58a97c
Merge branch 'main' into 129020-inline-missing-index-error
jughosta 3b866c7
[Data View] Update data view API usage
jughosta afb6834
Merge branch 'main' into 129020-inline-missing-index-error
jughosta 1b05045
[Data View] Update function signature
jughosta 2a60fb9
Merge remote-tracking branch 'origin/129020-inline-missing-index-erro…
jughosta 5df9cf1
Merge branch 'main' into 129020-inline-missing-index-error
jughosta cf76c87
[Data View] Update tests
jughosta fa996e8
Merge remote-tracking branch 'origin/129020-inline-missing-index-erro…
jughosta c472b93
Merge branch 'main' into 129020-inline-missing-index-error
jughosta c35a269
Merge branch 'main' into 129020-inline-missing-index-error
jughosta aee44c4
Merge remote-tracking branch 'upstream/main' into 129020-inline-missi…
jughosta 1aceefa
Merge branch 'main' into 129020-inline-missing-index-error
jughosta 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 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 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 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 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 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 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 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 |
---|---|---|
|
@@ -218,7 +218,7 @@ export function useDiscoverState({ | |
*/ | ||
const onChangeDataView = useCallback( | ||
async (id: string) => { | ||
const nextDataView = await dataViews.get(id); | ||
const nextDataView = await dataViews.get(id, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyplace where we're suppressing errors potentially needs a try/catch There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mattkime Updated by wrapping with try/catch. |
||
if (nextDataView && dataView) { | ||
const nextAppState = getDataViewAppState( | ||
dataView, | ||
|
This file contains 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 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 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 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 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 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 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
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.
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'm confused about the work this change is doing. As best I can tell it swallows errors since the error is caught but not re-thrown which isn't desired.
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.
@mattkime The previous code was causing an unhandled promise error which was not allowing to switch from SQL to regular mode in UI (for a data view with missing index)
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 handle the exception in the api consumer instead of changing the api?
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.
@mattkime Thanks for your suggestion! The thing is that the consumer is the data views service itself
kibana/src/plugins/data_views/common/data_views/data_views.ts
Line 894 in 4c386d9
Would you suggest to add try-catch there depending on
displayErrors
?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.
No, at least in theory the error will propagate up to the api consumer's call.
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.
@mattkime
dataView.get()
could still return a data view object for its consumer if we suppress exceptions forrefreshField
. If we change as you suggest then the consumer code would not be able to proceed which conflicts with the purpose of this PR.Agree with that. I'm not happy with the PR changes either. I can close it if that's our conclusion.
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.
Agree, there should be one way to handle it: to suppress the errors or to pass errors to the API consumers. This should also be clearly communicated to consumers, currently it seems it's a mixed handling of those cases?
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.
@jughosta Perhaps we should set up some time to discuss this. There's something I'm not understanding here.
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.
@kertal
I think our language might be conflating things. Currently, the api either displays errors or throws errors - and thrown errors need to be caught by api consumer code. 'Suppressing errors' could ambiguously mean either of those.
First we need to remove the possibility of errors from our communication regarding errors to successfully deal with errors. 🥲
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 created https://github.com/mattkime/kibana/pull/new/129020-inline-missing-index-error-mk to illustrate what I see as the path forward, particularly https://github.com/elastic/kibana/pull/150246/files#diff-eeffc98614da75c1f8e6ce9b07802c11dce0ae41f80b9540784f0f44c2e86133R307 - Now I think I did this before understanding what @jughosta was saying.
@jughosta - It took me a second reading to understand what you were looking to do -
Basically you're saying you want to be able to get a data view even if you can't get the field list. This isn't something thats currently supported by the API. A data view without a field list is of very limited use in most circumstances. Its an interesting idea. Current API consumers always assume the full field list is there - they don't have a notion of a data view with an unloaded field list. This is something I'd like to see changed but it would be a significant effort on the part of API consumers. Its actually something requested by solutions which deal with very large numbers of fields - that way they can choose when the field list is loaded.