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] Add raw status to Agent details UI #154826

Merged

Conversation

jillguyonnet
Copy link
Contributor

@jillguyonnet jillguyonnet commented Apr 12, 2023

Summary

Make raw agent status discoverable in Fleet UI, under Agent details tab.

Closes #154067

Screenshots

Screenshot 2023-04-19 at 12 14 48

Screenshot 2023-04-19 at 13 04 06

UX checklist

  • Action link title (View agent JSON)
  • Flyout title ({agentName} agent details)
  • Download button
  • Download button label (Download JSON)
  • Downloaded file name ({agentName}-agent-details.json)

Testing steps

  1. Run Kibana in dev on this branch.
  2. In Fleet, click on an agent to get to the agent details page.
  3. There should be a new View agent JSON item in the Actions menu. Click it.
  4. A new flyout should open with the agent details in JSON format. Clicking outside of the flyout or on the Close button should close the flyout.
  5. The Download JSON button should download the JSON correctly.

Checklist

@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 elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@jillguyonnet jillguyonnet self-assigned this Apr 12, 2023
@jillguyonnet
Copy link
Contributor Author

@kpollich @jen-huang @karenzone
Could I get some early review on the implementation based on the screenshots above?

@jen-huang
Copy link
Contributor

@jillguyonnet I think the code block is too big to be in the collapsible details area. WDYT of adding a new item to the Actions menu that says "View agent document"? The current actions menu:

image

When clicked, it can open a flyout with the raw document. This would make it consistent with an existing UX pattern that exists at Agent policy > Actions > View policy:

image

@jillguyonnet
Copy link
Contributor Author

@jen-huang Thank you! That looks way better and consistent with existing UX. On it.

@jillguyonnet jillguyonnet force-pushed the fleet/Add-raw-status-to-agent-details branch from d19bae3 to a4c3094 Compare April 13, 2023 11:18
@jillguyonnet jillguyonnet added Team:Fleet Team label for Observability Data Collection Fleet team release_note:enhancement v8.8.0 labels Apr 13, 2023
@kpollich
Copy link
Member

@jillguyonnet - Could you paste an example of the agent JSON here to make sure it aligns with what Craig is proposing in the original issue?

@jillguyonnet
Copy link
Contributor Author

jillguyonnet commented Apr 13, 2023

Thanks for catching the typo @kpollich :)

Here is an example JSON from my local dev:

JSON output
  {
"id": "430f2e47-0dc2-40a5-870e-07e861a38e67",
"access_api_key_id": "ws-8dYcBO_tAA7yPFnJS",
"action_seq_no": [
  -1
],
"active": true,
"agent": {
  "id": "430f2e47-0dc2-40a5-870e-07e861a38e67",
  "version": "8.8.0"
},
"enrolled_at": "2023-04-12T13:51:13Z",
"local_metadata": {
  "elastic": {
    "agent": {
      "build.original": "8.8.0-SNAPSHOT (build: 0c96fc55ec341d0a3c4f12477e5207e2827e3bdc at 2023-04-11 02:10:10 +0000 UTC)",
      "id": "430f2e47-0dc2-40a5-870e-07e861a38e67",
      "log_level": "info",
      "snapshot": true,
      "upgradeable": false,
      "version": "8.8.0"
    }
  },
  "host": {
    "architecture": "aarch64",
    "hostname": "dcfc864e0e1c",
    "id": "",
    "ip": [
      "127.0.0.1/8",
      "172.17.0.3/16"
    ],
    "mac": [
      "02:42:ac:11:00:03"
    ],
    "name": "dcfc864e0e1c"
  },
  "os": {
    "family": "debian",
    "full": "Ubuntu focal(20.04.5 LTS (Focal Fossa))",
    "kernel": "5.15.49-linuxkit",
    "name": "Ubuntu",
    "platform": "ubuntu",
    "version": "20.04.5 LTS (Focal Fossa)"
  }
},
"policy_id": "21fbd1e0-d917-11ed-8c4b-9f33f6a28da9",
"type": "PERMANENT",
"outputs": {
  "default": {
    "api_key": "xM-8dYcBO_tAA7yPIXJl:GIHnIyDtQK21XHJXIVGkcg",
    "permissions_hash": "a40c5fbf91c40a30ee69112a6e659e13513e37799d2264c866c42f8752d1d356",
    "type": "elasticsearch",
    "api_key_id": "xM-8dYcBO_tAA7yPIXJl"
  }
},
"policy_revision_idx": 3,
"policy_coordinator_idx": 1,
"updated_at": "2023-04-13T11:07:52Z",
"components": [
  {
    "id": "log-default",
    "units": [
      {
        "id": "log-default-logfile-system-240b02d0-d917-11ed-8c4b-9f33f6a28da9",
        "type": "input",
        "message": "Healthy",
        "status": "HEALTHY"
      },
      {
        "id": "log-default",
        "type": "output",
        "message": "Healthy",
        "status": "HEALTHY"
      }
    ],
    "type": "log",
    "message": "Healthy: communicating with pid '28'",
    "status": "HEALTHY"
  },
  {
    "id": "system/metrics-default",
    "units": [
      {
        "id": "system/metrics-default",
        "type": "output",
        "message": "Healthy",
        "status": "HEALTHY"
      },
      {
        "id": "system/metrics-default-system/metrics-system-240b02d0-d917-11ed-8c4b-9f33f6a28da9",
        "type": "input",
        "message": "Healthy",
        "status": "HEALTHY"
      }
    ],
    "type": "system/metrics",
    "message": "Healthy: communicating with pid '34'",
    "status": "HEALTHY"
  },
  {
    "id": "http/metrics-monitoring",
    "units": [
      {
        "id": "http/metrics-monitoring-metrics-monitoring-agent",
        "type": "input",
        "message": "Healthy",
        "status": "HEALTHY"
      },
      {
        "id": "http/metrics-monitoring",
        "type": "output",
        "message": "Healthy",
        "status": "HEALTHY"
      }
    ],
    "type": "http/metrics",
    "message": "Healthy: communicating with pid '46'",
    "status": "HEALTHY"
  },
  {
    "id": "filestream-monitoring",
    "units": [
      {
        "id": "filestream-monitoring-filestream-monitoring-agent",
        "type": "input",
        "message": "Healthy",
        "status": "HEALTHY"
      },
      {
        "id": "filestream-monitoring",
        "type": "output",
        "message": "Healthy",
        "status": "HEALTHY"
      }
    ],
    "type": "filestream",
    "message": "Healthy: communicating with pid '57'",
    "status": "HEALTHY"
  },
  {
    "id": "beat/metrics-monitoring",
    "units": [
      {
        "id": "beat/metrics-monitoring-metrics-monitoring-beats",
        "type": "input",
        "message": "Healthy",
        "status": "HEALTHY"
      },
      {
        "id": "beat/metrics-monitoring",
        "type": "output",
        "message": "Healthy",
        "status": "HEALTHY"
      }
    ],
    "type": "beat/metrics",
    "message": "Healthy: communicating with pid '69'",
    "status": "HEALTHY"
  }
],
"last_checkin_message": "Running",
"last_checkin_status": "online",
"last_checkin": "2023-04-13T11:07:49Z",
"policy_revision": 3,
"status": "online",
"packages": [],
"sort": [
  1681307473000
],
"metrics": {}
}

@karenzone
Copy link
Contributor

@zombieFox is joining Ingest to help with UX design. Looping him in here.

>
<FormattedMessage
id="xpack.fleet.agentList.viewAgentDocumentText"
defaultMessage="View agent document"
Copy link
Contributor

Choose a reason for hiding this comment

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

We try to be as descriptive with labeling as possible so that users have a better idea of what an option will do for them.

Could we use "View agent json" instead of "View agent document"? My first thought was "View agent details,", but that label is already being used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @karenzone - I am not sure whether there is a UX pattern in this case. View agent json sounds clear to me. There is a sort of equivalent in the agent policy simply labelled View policy (note that the output is represented as yaml, not json, like in the screenshot @jen-huang posted above), so maybe View agent could even make sense? Or maybe View full agent details?

@zombieFox As it looks like Karen is on PTO this week could you weigh in on this?

cc @jen-huang @kpollich

Screenshot 2023-04-17 at 15 26 20

@kpollich
Copy link
Member

I think it'd be good if we could add some kind of description here, as it's not clear why a user might open this flyout or what they should do with the resulting data.

image

Maybe something like

The JSON below is the raw agent data tracked by Fleet. This data can be useful for debugging or troubleshooting Elastic Agent. For more information, see the troubleshooting documentation.

cc @karenzone for copy suggestions 🙏

@zombieFox
Copy link
Contributor

Hi all 👋🏽

From the limited context I have the I feel the comments and contributors here are on the right path.

+1 to the View agent document CTA in the dropdown and the flyout panel for the large code block. This UI pattern works well here.

I think it'd be good if we could add some kind of description here, as it's not clear why a user might open this flyout or what they should do with the resulting data.

+1 to adding more details on the flyout to guide users to useful information in the JSON code block.

This might add scope, so please disregard if so - A question:

  • Are there any parts of the code block we can automatically highlight to help debug the failed state?

@jillguyonnet
Copy link
Contributor Author

jillguyonnet commented Apr 17, 2023

Hi @zombieFox - thank you for your feedback!

+1 to adding more details on the flyout to guide users to useful information in the JSON code block.

Definitely 👍 Could you weigh in on Kyle's suggestion above? As mentioned in the other thread, it looks like Karen is off this week.

Are there any parts of the code block we can automatically highlight to help debug the failed state?

While it is possible to highlight certain lines (https://elastic.github.io/eui/#/editors-syntax/code), which lines are relevant for debugging might depend on the specific failure scenario. I am not sure in my current understanding how feasible that would be. Maybe @kpollich can confirm.

@kpollich
Copy link
Member

While it is possible to highlight certain lines (https://elastic.github.io/eui/#/editors-syntax/code), which lines are relevant for debugging might depend on the specific failure scenario. I am not sure in my current understanding how feasible that would be. Maybe @kpollich can confirm.

We could look for any components with a status of UNHEALTHY and highlight the status and message fields. I don't think this would be particularly meaningful here, though. Let's punt on that for this PR and maybe we can take a look at all of our EuiCodeBlock usages across the board for an enhancement along those lines.

@jillguyonnet jillguyonnet force-pushed the fleet/Add-raw-status-to-agent-details branch from e364c2e to d33c8af Compare April 19, 2023 11:20
@kibana-ci
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
fleet 798 799 +1

Async chunks

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

id before after diff
fleet 945.5KB 948.0KB +2.5KB
Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 432 435 +3

Total ESLint disabled count

id before after diff
securitySolution 512 515 +3

History

  • 💛 Build #119849 was flaky e364c2ed1d1477c7647f0390997422945fda0ce2
  • 💚 Build #119773 succeeded 8264f89cb708e157e116aa6006c935f6a5684c4f
  • 💛 Build #119739 was flaky 536be72e911d6aed43669719629673ba2aa7cabf
  • 💚 Build #119442 succeeded d19bae38ee454c5a061e7ff317348445b4032bff

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

cc @jillguyonnet

@jillguyonnet jillguyonnet marked this pull request as ready for review April 19, 2023 13:02
@jillguyonnet jillguyonnet requested a review from a team as a code owner April 19, 2023 13:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jillguyonnet
Copy link
Contributor Author

Opening this for review based on the feedback gathered so far.

@karenzone @zombieFox If this gets merged before you get a chance to do any more reviewing, please note that any additional UX feedback such as wording can very easily be added at a later stage.

@elastic/fleet Something I'm not 100% confident with is the implementation of the download link (seems like a shame to do an API call since the payload is already in memory). Please have a critical look at it when reviewing, thanks 🙂

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.

Code LGTM! I also tested locally and it works well. 🚢

@jillguyonnet jillguyonnet merged commit b97b18e into elastic:main Apr 21, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Apr 21, 2023
@jillguyonnet jillguyonnet deleted the fleet/Add-raw-status-to-agent-details branch April 21, 2023 13:19
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:enhancement Team:Fleet Team label for Observability Data Collection Fleet team v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Allow inspecting the raw agent status document to quickly diagnose unhealthy agents
10 participants