-
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
[Fleet] Request diagnostics #142369
[Fleet] Request diagnostics #142369
Conversation
Pinging @elastic/fleet (Team:Fleet) |
@juliaElastic super excited to see so much progress on this already. Do we need to wait for the Fleet Server and Agent dependencies to be merged before we merge this? |
@joshdover yes, we need the backend implementation of the action, otherwise it would be an action that never completes. |
@elasticmachine merge upstream |
77ee9bf
to
f165ee7
Compare
@pmuellr See the reasoning here: #138870 |
@@ -15,6 +15,7 @@ export const allowedExperimentalValues = Object.freeze({ | |||
createPackagePolicyMultiPageLayout: true, | |||
packageVerification: true, | |||
showDevtoolsRequest: true, | |||
showRequestDiagnostics: false, |
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.
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.
Thanks for adding this!
return actionResults.hits.hits.map((hit) => ({ | ||
actionId: hit._source?.action_id as string, | ||
timestamp: hit._source?.['@timestamp'], | ||
fileId: hit._source?.data?.file_id as string, |
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.
taking the file_id
from action results, this part is not yet implemented, asked here: elastic/elastic-agent#1631 (comment)
> | ||
<FormattedMessage | ||
id="xpack.fleet.requestDiagnostics.calloutText" | ||
defaultMessage="Diagnostics files are stored in Elasticsearch, and as such can incur storage costs. Fleet will automatically remove old diagnostics files after 30 days." |
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.
This callout text might have to be updated if we agreed on a different max age then 30 days.
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled in files
ESLint disabled line counts
Total ESLint disabled count
History
To 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.
I tested the branch locally, I'm not sure if the upload part can be tested yet but up to the point works as per requirements.
In my local I see that the UI gets stuck in loading state when requesting the diagnostic, so it's difficult to test the rest of the flow.
I just have a question. From the agent activity is possible to see that the diagnostics where requested, but it's hard to know for which agent. It's totally fine in case of bulk requests, but would it make sense to consider adding the agent id for single requests?
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 🚢
@@ -127,6 +127,8 @@ export const AGENT_API_ROUTES = { | |||
BULK_UNENROLL_PATTERN: `${API_ROOT}/agents/bulk_unenroll`, | |||
REASSIGN_PATTERN: `${API_ROOT}/agents/{agentId}/reassign`, | |||
BULK_REASSIGN_PATTERN: `${API_ROOT}/agents/bulk_reassign`, | |||
REQUEST_DIAGNOSTICS_PATTERN: `${API_ROOT}/agents/{agentId}/request_diagnostics`, |
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.
Could you add the new endpoints to the docs? It can be done in a separate PR as well
Thanks for the review!
We have an enhancement to add more insight into the agents actioned: #141206 I think in Request Diagnostics case this shouldn't be an issue, because when taking the action on a single agent, the UI should navigate to Agent Details / Diagnostics tab. |
Here are the steps how I tested e2e locally:
Show code
Show code
|
NOTE: this feature is turned off in 8.6 as the backend is not ready yet. The feature is planned to be enabled in 8.7. |
Related to elastic/observability-docs#2506 The change for #142369 did not make it into the 8.6 release.
…8842) Related to elastic/observability-docs#2506 The change for #142369 did not make it into the 8.6 release. ## Summary n/a ### Checklist n/a
Hi Team, We have created 11 testcases for this feature under our Fleet test suite at link: Please let us know if any other scenario is missing from our end. |
Summary
Closes #141074
Request diagnostics action
Added new action for single agent (Agent details page and Agent list row actions) to request diagnostics.
When clicking on the action, an API request is made that creates a
REQUEST_DIAGNOSTICS
type action in.fleet-actions
index.Diagnostics uploads display
When the action is submitted, the user is navigated to the new
Agent Details / Diagnostics
tab, which shows the list of pending and completed diagnostics file uploads. The information is coming from the/action_status
(for action status) as well as the/uploads
endpoint (for file name and path)By clicking on a diagnostics link, the file should be downloaded in zip.
Failed uploads display:
Expired status was not specified in the design separately, it will be shown like the failed status (with warning icon).
Mock data (blocker)
Currently returning mock data in the
/uploads
API, because of a blocker in Kibana File Service, see here.Bulk action
Added bulk action too:
Shows up in agent activity:
The Fleet Server / Agent changes are not there yet, though FS delivers the action, and Agents ack it (looks like default behavior for unkown actions as well)
Confirmation modal
Added a confirmation modal when clicking on action button everywhere, except for the
Request diagnostics
button on the Diagnostics page.Open question:
Download
Generated file path to download in this format:
/api/fleet/agents/files/{fileId}/{fileName}
Decided not to try to use
files
plugin's API because it doesn't have the Fleet authorization around it.Screen recording demonstrating the download of an agent diagnostics zip file, that I uploaded using the Fleet Server upload API (using Dan's pr locally)
file_download.mov
Notification
Added toast message to show up when a diagnostics becomes ready, when we are on the Diagnostics tab.
diag_notif.mov
Checklist
Delete any items that are not applicable to this PR.