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

[Console] Add Kibana APIs Support #128562

Merged
merged 16 commits into from
Apr 21, 2022
Merged

[Console] Add Kibana APIs Support #128562

merged 16 commits into from
Apr 21, 2022

Conversation

mibragimov
Copy link
Contributor

@mibragimov mibragimov commented Mar 25, 2022

Closes #49330

This PR continues the work from #99102.

Completed tasks

  • Send requests to Kibana APIs from the client instead of the server.
  • Prettify formatting of JSON responses.
  • Fix "Copy as cURL" functionality

Testing

To test this out, enter a request against a Kibana API, but prefix the path with kbn:, to help the Console API differentiate between ES API and Kibana API requests. For example:

GET kbn:api/index_lifecycle_management/policies

_Originally posted by @cjcenizal in #99102

Release Note

Dev Tools Console now supports sending requests to Kibana APIs: prepend any Kibana API endpoint with kbn: and send the request via Console, for example, GET kbn:/api/index_management/indices.

Screenshots Capture (3) Capture

@mibragimov mibragimov added release_note:enhancement Feature:Console Dev Tools Console Feature Feature:Dev Tools Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v8.2.0 labels Mar 25, 2022
@mibragimov mibragimov self-assigned this Mar 25, 2022
@mibragimov
Copy link
Contributor Author

@jen-huang @legrego @kobelb @jfsiii @wylieconlon I made some changes as per the comments on #99102. Could you please review this functionality again and provide your feedback? Thank you in advance!

@mibragimov
Copy link
Contributor Author

@elasticmachine merge upstream

1 similar comment
@mibragimov
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Member

@legrego legrego left a comment

Choose a reason for hiding this comment

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

I did a quick pass (test only, no code review), and my initial concerns all look resolved - nice work! I tested in a couple of different spaces, and it appears that this is respecting the current space, which is perfect.

I briefly tested "Copy as cURL", and that doesn't seem to copy anything to my clipboard.

One nit: It would be nice if we could support both GET kbn:api/... and GET kbn:/api/.... Adding the leading / results in a 404 response.

image

image

@mibragimov
Copy link
Contributor Author

mibragimov commented Mar 29, 2022

I did a quick pass (test only, no code review), and my initial concerns all look resolved - nice work! I tested in a couple of different spaces, and it appears that this is respecting the current space, which is perfect.

I briefly tested "Copy as cURL", and that doesn't seem to copy anything to my clipboard.

One nit: It would be nice if we could support both GET kbn:api/... and GET kbn:/api/.... Adding the leading / results in a 404 response.

image image

@legrego thank you for testing this out! I updated the PR with your suggestion for supporting leading /. Also, I tested "Copy as cURL" on Linux and it seems to be working for me. I wonder if it is related to the platform

Capture1

@elasticmachine
Copy link
Contributor

Pinging @elastic/platform-deployment-management (Team:Deployment Management)

@mibragimov mibragimov force-pushed the kibana-api branch 2 times, most recently from 0a1ba2d to 72581f5 Compare April 14, 2022 06:34
@mibragimov mibragimov added the backport:skip This commit does not require backporting label Apr 21, 2022
Copy link
Member

@sabarasaba sabarasaba left a comment

Choose a reason for hiding this comment

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

Latest changes lgtm, tested locally. Thanks a ton for working on this @mibragimov! Left a tiny nit, but feel free to ignore it 🚀

src/plugins/console/common/constants/api.ts Outdated Show resolved Hide resolved
@mibragimov mibragimov enabled auto-merge (squash) April 21, 2022 12:59
@mibragimov
Copy link
Contributor Author

Thanks for the review @yuliacech @sabarasaba !

@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Test Failures

  • [job] [logs] Default CI Group #4 / lens app lens drag and drop tests basic drag and drop should combine breakdown dimension with the horizontal one
  • [job] [logs] Default CI Group #4 / lens app "after all" hook in "lens app"

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
console 399.5KB 399.8KB +277.0B

History

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

cc @mibragimov

@mibragimov mibragimov merged commit 502a00b into elastic:main Apr 21, 2022
jbudz added a commit that referenced this pull request Apr 21, 2022
@jbudz
Copy link
Member

jbudz commented Apr 21, 2022

This was reverted with f41dc1f.

on-merge CI stated failing at https://buildkite.com/elastic/kibana-on-merge/builds/15267

@jbudz jbudz added the reverted label Apr 21, 2022
alisonelizabeth added a commit to alisonelizabeth/kibana that referenced this pull request Apr 21, 2022
cjcenizal pushed a commit that referenced this pull request Apr 21, 2022
* Revert "Revert "[Console] Add Kibana APIs Support (#128562)""

This reverts commit f41dc1f.

* fix functional test
@cjcenizal
Copy link
Contributor

Fixed and reinstated in #130816

@mibragimov mibragimov deleted the kibana-api branch April 25, 2022 07:23
@getkub
Copy link

getkub commented Apr 26, 2022

I did a quick pass (test only, no code review), and my initial concerns all look resolved - nice work! I tested in a couple of different spaces, and it appears that this is respecting the current space, which is perfect.
I briefly tested "Copy as cURL", and that doesn't seem to copy anything to my clipboard.
One nit: It would be nice if we could support both GET kbn:api/... and GET kbn:/api/.... Adding the leading / results in a 404 response.

Liked the idea, but what about large "clustered" systems and Cross cluster search? how would you define "kbn" for another instance of Elastic/Kibana? Should it have provision to define by IP/endpoint URL/port too?
something like..

GET  cluster1:5601/api/spaces

@cjcenizal
Copy link
Contributor

Thanks for the suggestion @getkub! In the past we've discussed and decided against enabling Console to send requests to different clusters. Relevant issues:

dmlemeshko pushed a commit to dmlemeshko/kibana that referenced this pull request May 5, 2022
* Add support for Kibana API requests

* Fix failing tests

* Support leading / and minor refactor

* Resolve conflicts

* Update send_request.test file

* Refactor

* Add functional test

* Address comments

* Fix typo

* Resolve conflicts and refactor error handling

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Address comments

* Resolve merge conflicts

* Rename KIBANA_API_KEYWORD

Co-authored-by: Muhammad Ibragimov <muhammad.ibragimov@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
dmlemeshko pushed a commit to dmlemeshko/kibana that referenced this pull request May 5, 2022
dmlemeshko pushed a commit to dmlemeshko/kibana that referenced this pull request May 5, 2022
* Revert "Revert "[Console] Add Kibana APIs Support (elastic#128562)""

This reverts commit f41dc1f.

* fix functional test
kertal pushed a commit to kertal/kibana that referenced this pull request May 24, 2022
* Add support for Kibana API requests

* Fix failing tests

* Support leading / and minor refactor

* Resolve conflicts

* Update send_request.test file

* Refactor

* Add functional test

* Address comments

* Fix typo

* Resolve conflicts and refactor error handling

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

* Address comments

* Resolve merge conflicts

* Rename KIBANA_API_KEYWORD

Co-authored-by: Muhammad Ibragimov <muhammad.ibragimov@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
kertal pushed a commit to kertal/kibana that referenced this pull request May 24, 2022
kertal pushed a commit to kertal/kibana that referenced this pull request May 24, 2022
* Revert "Revert "[Console] Add Kibana APIs Support (elastic#128562)""

This reverts commit f41dc1f.

* fix functional test
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 Feature:Console Dev Tools Console Feature Feature:Dev Tools release_note:enhancement reverted Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v8.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Console Kibana APIs Support
10 participants