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

[UII] Surface option to delete diagnostics files #183690

Merged
merged 23 commits into from
May 20, 2024

Conversation

jen-huang
Copy link
Contributor

@jen-huang jen-huang commented May 17, 2024

Summary

Resolves #167366.

This PR introduces the ability to manually delete diagnostics files before their ILM policy kicks in. This PR:

  • Adds a new DELETE /api/fleet/agents/files/{fileId} route which returns {id: string, deleted: boolean}
  • Deletes the file from .fleet-fileds-fromhost-data-agent data stream when a request is received, and updates the corresponding meta information in .fleet-fileds-fromhost-meta-agent to set it to DELETED status
  • Updates the Agent details > Diagnostics tab:
    • Surface Delete action in files table for requests that resulted in files
    • Refactors existing UI around the copy text and generate button
    • Add Show expired requests toggle
      • Off by default, which means the following will be shown:
        • Files that are on disk
        • Files being generated
        • File requests which errored out but are still not expired (i.e. users can see errors with recent requests)
      • When toggled on, will additionally show:
        • File requests which errored out AND are expired
        • File requests that are just expired (i.e. edge case where a file was deleted by ILM but the meta info had not yet reconciled)

FYI, the expiration threshold is currently only 3 minutes. This is a bug, see: #183692

The main reason for adding this toggle is to keep the initial list view clean. The items in this list are built from all REQUEST_DIAGNOSTICS agent actions that the user submits, which can be on a single agent or bulk agents.

When a file is deleted manually with this new work, or by the existing ILM policy, we can correctly flag the associated action as having DELETED files and hide it from view. But when a request errors out or otherwise results in no files being generated, we still want to keep the history of the request (we have no precedent of deleting agent activity). Over time, this history is no longer useful for the user and just pollutes the table, so it is better to hide these items from the initial view.

image image

Testing

Use the single and bulk request diagnostics feature and test the delete functionality. Go nuts :)

Checklist

@jen-huang jen-huang added Team:Fleet Team label for Observability Data Collection Fleet team release_note:feature Makes this part of the condensed release notes v8.15.0 labels May 17, 2024
@jen-huang jen-huang self-assigned this May 17, 2024
@jen-huang jen-huang requested review from a team as code owners May 17, 2024 01:29
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Contributor

@kilfoyle kilfoyle left a comment

Choose a reason for hiding this comment

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

LGTM for the docs. 👍
Here's a docs update PR for the new delete option.

@jen-huang jen-huang requested a review from kpollich May 17, 2024 20:37
Copy link
Member

@kpollich kpollich left a comment

Choose a reason for hiding this comment

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

Code + tests LGTM, I did not pull down to test locally 🚀

I expect the next thing we'll be asked for on this page would be bulk delete. Do you think it makes sense to put an issue for that on the backlog for now?

@kibanamachine kibanamachine requested a review from a team as a code owner May 20, 2024 16:37
@jen-huang jen-huang removed request for a team, ashokaditya and parkiino May 20, 2024 16:44
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #39 / discover/group4 discover esql view inspector shows Discover and Lens requests in Inspector

Metrics [docs]

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 1184 1187 +3

Async chunks

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

id before after diff
fleet 1.3MB 1.3MB +1.7KB

Page load bundle

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

id before after diff
fleet 164.1KB 164.4KB +364.0B
Unknown metric groups

API count

id before after diff
fleet 1305 1308 +3

History

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

cc @jen-huang

@jen-huang jen-huang merged commit c744649 into elastic:main May 20, 2024
20 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 20, 2024
@jen-huang jen-huang deleted the feat/delete-diagnostics branch May 20, 2024 18:23
@jen-huang
Copy link
Contributor Author

@kpollich I opened #183857

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 release_note:feature Makes this part of the condensed release notes Team:Fleet Team label for Observability Data Collection Fleet team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Add Delete Button in Fleet Interface for Managing Diagnostic Logs
7 participants