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

[Fleet] [Feature Branch] Create Fleet _debug UI #131322

Merged
merged 42 commits into from
Jun 21, 2022
Merged

Conversation

kpollich
Copy link
Member

@kpollich kpollich commented May 2, 2022

Summary

ON week project for a "debugging" interface within the Fleet app that allows us to manage Fleet data, diagnose issues, and more effectively work with support engineers.

Screenshot

localhost_5601_kyle_app_fleet__debug

Implementation

  • Bootstrap a _debug page
  • Set up React Query
  • Implement Agent Policy module - @kpollich - [Fleet] [Debug UI] Implement "Agent Policy Debugger" UI #131335
    • Search or select an Agent Policy from a pre-populated dropdown
    • Display the compiled policy object as JSON in a react-only EuiCodeEditor code block
      • EuiCodeEditor allows for folding of code blocks, which would be a handy feature for these large JSON objects. If it becomes cumbersome, we can use a more plain EuiCodeBlock
      • From the EUI docs: "EuiCode and EuiCodeBlock are intended to render static lines or blocks of code in read-only contexts. If you need capabilities to edit, or want to print long code (e.g., printing JSON from an API), we recommend installing a version of Monaco. If you are building within the Kibana platform, you can use their CodeEditor."
    • Allow an Agent Policy to be deleted if there are no enrolled agents
    • Include a link to the Agent Policy in the Fleet UI
  • Implement Fleet Saved objects module - @juliaElastic - [Fleet] Saved Objects Debugger #131370
    • Select a saved object type from a dropdown of options
    • Allow for text-based search against the selected saved object type
    • Display the resulting saved object data in a JSON code block
  • Implement Integrations module - @kpollich - [Fleet] [Debug UI] Implement "Integration Debugger" UI #131354
    • Search or select an installed integration from a pre-populated dropdown
    • Allow integrations to be reinstalled (an uninstall followed by an immediate install)
    • Allow integration to be uninstalled
    • Include a link to the integration details page for each integration
  • Implement showing the content of Fleet actions and agents indices @juliaElastic - [Fleet] Added fleet indices query to debug UI #131395
  • Implement Preconfiguration module - @kpollich - [Fleet] [Debug UI] Implement "Preconfiguration debugger" UI #131436
    • Select a preconfigured policy from a dropdown (we likely don't need search here, there should only ever be a few of these)
    • Render a JSON code block containing the compiled contents of the selected policy
    • Allow all preconfigured policies to be reset in bulk using the "reset preconfiguration" API
    • Allow the selected policy to be reset individually using the "reset preconfiguration" API
    • Include a link to the preconfigured policy's Agent Policy details page in Fleet UI

Stretch Goals (per @juliaElastic)

Deferred

  • Implement Fleet Server Status module @juliaElastic - deferred as blocked by cross origin call
    • Select a Fleet Server host populated via Fleet Settings
    • Display the response from the /api/status endpoint for the given Fleet Server host in a JSON code block

@kpollich kpollich added release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.3.0 labels May 2, 2022
@kpollich kpollich requested a review from a team as a code owner May 2, 2022 12:58
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

* Add initial agent policy debugger module

* Fix clear button in agent policy select

* Implement deletion of selected policy

* Fix layout of combo-box/button

* Add searchable ID to agent policy labels

* Add description text to debugger module

* Fixup loading/error logic
@juliaElastic
Copy link
Contributor

juliaElastic commented May 3, 2022

I realized that querying <Fleet Server host>/api/status is not going to work from the UI, because of CORS.
It could be done from server side, but I think it's not super useful as Fleet UI already shows statuses of Agents.
I'll defer this for now.

EDIT: I tried making the status call on the backend with node-fetch, but it has a problem with the ssl certificate, I don't know if this is because of the self-signed certificate I used or a general problem. I think I'm not going to spend more time on this.
[ERROR][http] FetchError: request to https://localhost:8220/api/status failed, reason: unable to verify the first certificate

* saved objects debugger

* converted so names to combobox

* types fix

* extracted combo box component

* fixed error display
kpollich added 2 commits May 3, 2022 09:29
* Implement integrations debugger UI

* Clean up + add link to integration settings

* Add divider below integration debugger

* Clean up loading states
@kpollich
Copy link
Member Author

kpollich commented May 3, 2022

@juliaElastic - for this task:

Implement showing the content of Fleet actions and agents indices

We aren't showing contents of .fleet-actions indices yet, right? Is that something we'd like to look at?

@kpollich
Copy link
Member Author

kpollich commented May 3, 2022

Scratch that - I just saw #131395 come through 🙂

* fleet indices

* keeping the type and name combo close in saved objects

* fixed prettier
juliaElastic and others added 5 commits May 4, 2022 10:15
* Implement preconfiguration debugger UI

* Add code block view

* Added missing newline

Co-authored-by: Julia Bardi <[email protected]>
* added links including health check report

* experiment with accordion

Co-authored-by: Kibana Machine <[email protected]>
@kpollich kpollich marked this pull request as ready for review May 4, 2022 16:39
@kpollich
Copy link
Member Author

kpollich commented May 4, 2022

@elasticmachine merge upstream

@kpollich
Copy link
Member Author

@elasticmachine merge upstream

@jen-huang jen-huang added v8.4.0 and removed v8.3.0 labels Jun 16, 2022
@kpollich kpollich requested a review from a team June 16, 2022 11:52
@kpollich
Copy link
Member Author

@elasticmachine merge upstream

@kpollich kpollich requested review from criamico and nchaulet June 21, 2022 15:37
Copy link
Contributor

@criamico criamico left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the review comments. LGTM

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 669 720 +51

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
fleet 1300 1307 +7

Async chunks

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

id before after diff
fleet 754.0KB 840.0KB +86.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 93.1KB 94.9KB +1.8KB
Unknown metric groups

API count

id before after diff
fleet 1427 1434 +7

History

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

cc @kpollich @juliaElastic

@kpollich kpollich merged commit d8558fc into main Jun 21, 2022
@kpollich kpollich deleted the feature/fleet-debug-page branch June 21, 2022 16:22
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jun 21, 2022
@tylersmalley tylersmalley added ci:cloud-deploy Create or update a Cloud deployment and removed ci:deploy-cloud labels Aug 17, 2022
@lucabelluccini
Copy link
Contributor

Awesome! ❤️

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 ci:cloud-deploy Create or update a Cloud deployment release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.