-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Improve kql error message handling and avoid fetcihng twice #54239
Improve kql error message handling and avoid fetcihng twice #54239
Conversation
💚 Build SucceededTo update your PR or re-run it, just comment with: |
Pinging @elastic/kibana-app (Team:KibanaApp) |
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.
LGTM
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.
Error message fix looks good 👍
The change to the watcher does fix the double request, though I'm a bit worried we're missing whatever change caused this to happen in the first place. That watcher has been around for a long time but the double request seems to be a recent problem. Also Visualize and Dashboard have similar watchers, but don't have this problem. They've diverged enough that I can't immediately see what the difference is though. I thought courier had some deduplication logic in the past, I wonder if anything changed there @lukasolson ?
In any case I suppose this fix works fine for the problem at hand in Discover, I'm just nervous that we don't know why it broke.
@Bargs I can reproduce the problem on fyi @rayafratkina Merging this despite missing code ownership review from Kibana App (come back home @Bargs , we miss you). |
@flash1293 the $scope.fetch happens outside of the conditional you linked to, so that doesn't explain that lack of a double fetch. I dunno how long this problem has existed, but that watcher has been around since 6.x and I don't think we've been doing a double fetch for that long. |
Ah, you are right, the story is more complicated than that. There is also a double fetch on changing the time filter, so it might be an underlying problem. I will keep digging and test some older releases as well to pin-point it. #54526 |
Fixes #48392
The code building the errors message for a KQL parsing exception assumes the
expected
property is an array - in some cases (e.g. when using a leading wildcard) this is not the case.This PR makes sure in these cases a meaningful error message is built.
While working on this problem I noticed that Discover sends two requests when updating the query because there is a watcher on the
query
state that triggers an additional fetch. In this PR it is made sure that the fetch is only triggered when necessary.