-
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
[SearchProfiler] Fix handling of bad profile data and update tab behaviour #55806
[SearchProfiler] Fix handling of bad profile data and update tab behaviour #55806
Conversation
Also fix tab changing upon subsequent requests
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
💚 Build SucceededTo update your PR or re-run it, just comment with: |
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.
Code LGTM. Tested locally; confirmed fix and verified tab behavior. I think as an improvement to this (not blocking), it would be nice to render a callout message or something indicating the user provided bad profile data, rather than just an empty screen.
…viour (elastic#55806) * Fix searchprofiler's ability to handle badly formed profile data Also fix tab changing upon subsequent requests * Fix comment typo
TIL 💡 |
…viour (elastic#55806) * Fix searchprofiler's ability to handle badly formed profile data Also fix tab changing upon subsequent requests * Fix comment typo # Conflicts: # x-pack/legacy/plugins/searchprofiler/public/np_ready/application/utils/has_aggregations.ts # x-pack/legacy/plugins/searchprofiler/public/np_ready/application/utils/has_searches.ts # x-pack/plugins/searchprofiler/public/application/components/profile_tree/__tests__/profile_tree.test.tsx # x-pack/plugins/searchprofiler/public/application/containers/main/main.tsx
…viour (#55806) (#55971) * Fix searchprofiler's ability to handle badly formed profile data Also fix tab changing upon subsequent requests * Fix comment typo # Conflicts: # x-pack/legacy/plugins/searchprofiler/public/np_ready/application/utils/has_aggregations.ts # x-pack/legacy/plugins/searchprofiler/public/np_ready/application/utils/has_searches.ts # x-pack/plugins/searchprofiler/public/application/components/profile_tree/__tests__/profile_tree.test.tsx # x-pack/plugins/searchprofiler/public/application/containers/main/main.tsx Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Summary
There is a less known feature of SearchProfiler that enables users to provide a profile response JSON object in the text editor. When they click "Profile" it detects the presence of profile data, short circuits the network requests and goes straight to rendering a profile tree.
It is not clear how many users actually use this functionality, given that it is not really advertised in the UI, but currently pasting a bad profile (malformed) into the SearchProfiler text editor and clicking profile crashes the app. Steps:
{ "profile": { "shards": [{}] } }
into the text editorThis contribution adds a
try..catch
to prevent the UI from hard crashing.This contribution also updates auto-setting of tabs under different conditions. If the user is viewing an aggregation, the UI shouldn't switch back to query if they submit another aggregation.
E.g.
This bug should exist on previous Kibana versions too.
Release note
Fixed crash on bad profile data in SearchProfiler.
Checklist
Use
strikethroughsto remove checklist items you don't feel are applicable to this PR.This was checked for cross-browser compatibility, including a check against IE11Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n supportDocumentation was added for features that require explanation or tutorialsThis was checked for keyboard-only and screenreader accessibilityFor maintainers
This includes a feature addition or change that requires a release note and was labeled appropriately