fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Surface queries on host details tab

Open noahtalerman opened this issue 1 year ago • 15 comments

Goal

User story
As an IT admin on the Host details page,
I want to be able to quickly see my custom attributes
so that I don't have to navigate away to the Queries tab.

Roadmap item

None

Original requests

  • https://github.com/fleetdm/fleet/issues/28681

Resources

None

Changes

Product

  • [x] UI changes: Figma
  • [x] CLI (fleetctl) usage changes: No changes
  • [x] YAML changes: No changes
  • [x] REST API changes: No changes
  • [x] Fleet's agent (fleetd) changes: No changes
  • [x] GitOps mode UI changes: No changes
  • [x] GitOps generation changes: No changes
  • [x] Activity changes: No changes
  • [x] Permissions changes: No changes
  • [x] Changes to paid features or tiers: No changes
  • [x] My device and fleetdm.com/better changes: No changes
  • [x] Other reference documentation changes: No changes
  • [x] First draft of test plan added
  • [x] Once shipped, requester has been notified
  • [x] Once shipped, dogfooding issue has been filed

Engineering

IMPORTANT: No backend changes on this iteration. Note that Host > Queries is populated with pack_stats returned by the GET /api/latest/fleet/hosts/:id API endpoint. Pagination (4 per page) will need happen on the frontend in this iteration.

  • [X] Test plan is finalized
  • [X] Contributor API changes: No changes.
  • [X] Feature guide changes: No changes.

QA

Risk assessment

  • Risk level: Low

Test plan

Make sure to go through the list and consider all events that might be related to this story, so we catch edge cases earlier.

Hosts > Host Details page:

  1. Check that "Queries" is no longer in subnav.
  2. First section (no header) contains:
  • Status, Team, OS settings, and Issues
  1. Confirm "About" has been combined into new section, "Vitals", with stats from "About" section plus:
  • Disc space
  • Disc encryption
  • Memory
  • Processor type
  • Operating system
  • Agent
  1. New section "Queries":
  • If queries are populated confirm:

    • you can sort by "Name" or "Last updated"
    • tooltip for "Last updated" appears
  • If no queries and device supports queries empty state: Image

  • If no queries and device does not support queries empty state: Image

  • If more than 4 queries, pagination navigation should appear at the bottom of section: Image

  1. Clicking on "Add query" redirects to New Query page (/queries/new).
  • Confirm new subtext is under "New Query" heading with dynamically set team or if global.
    • Confirm on "New Policy" page as well.
  • Create a new query, navigate back to Host details page and confirm it appears in the queries table
  1. Clicking on "View data" in queries table takes you to Query results page.
  • Check that "Performance Impact" is there with the correct value. Check that tooltip aligns with displayed value.
  1. Confirm top right link has new copy: "View data for all hosts" (previously "View full query report"), and takes you to full host list for that query.

My Device > Details page

  1. First section (no header) contains:
  • Status, Team, OS settings, and Issues
  1. Confirm "About" has been combined into new section, "Vitals", with stats from "About" section plus:
  • Disc space
  • Disc encryption
  • Memory
  • Processor type
  • Operating system
  • Agent

Testing notes

Confirmation

  1. [X] Engineer: Added comment to user story confirming successful completion of test plan.
  2. [ ] QA: Added comment to user story confirming successful completion of test plan.

noahtalerman avatar Mar 19 '25 21:03 noahtalerman

@noahtalerman is this the issue for customer-ufa also?

zayhanlon avatar Apr 01 '25 01:04 zayhanlon

@zayhanlon I think yes but this is the user story. It's part of the "Filter hosts with custom host vitals" OKR. To replace Sal.

We looked and couldn't find an ufa customer request for Sal replacement. Can you please help us find the request? Or just create a new one if that's faster. That way we can collect Gong snippets there and bring it through unpacking the why.

noahtalerman avatar Apr 01 '25 21:04 noahtalerman

@noahtalerman just realized I forgot to add the story label after converting this from an air guitar, so we missed adding it back to feature fest.

rachaelshaw avatar Apr 10 '25 22:04 rachaelshaw

@lukeheath @noahtalerman @zayhanlon

Adding a "P2" label to this user story so the ENG team doesn't lose track of this critically important feature request

Patagonia121 avatar Sep 26 '25 00:09 Patagonia121

OR

User story
As an IT admin on the Host details page,
I want to see the first column of the first row for custom query results
so that I can write extension attributes in Fleet.

noahtalerman avatar Oct 06 '25 14:10 noahtalerman

@rachaelshaw I was able to test additional_queries and it worked about as I expected:

  • I added:
team_settings:
  features:
    additional_queries:
      time: SELECT * FROM time;
      macOS_MAC_Address: SELECT mac FROM interface_details;

to my team config in GitOps and re-fetched a host

  • The host API response on the host details page now includes:
    "additional": {
      "time": [
        {
          "day": "21",
          "hour": "0",
          "year": "2025",
          "month": "11",
          "minutes": "32",
          "seconds": "23",
          "weekday": "Friday",
          "datetime": "2025-11-21T00:32:23Z",
          "iso_8601": "2025-11-21T00:32:23Z",
          "timezone": "UTC",
          "timestamp": "Fri Nov 21 00:32:23 2025 UTC",
          "unix_time": "1763685143",
          "local_timezone": "CST"
        }
      ],
      "macOS_MAC_Address": [
        {
          "mac": "00:00:00:00:00:00"
        },
        {
          "mac": "00:0c:29:3a:4f:dd"
        }
      ]
    },

so it's an array of rows per named query.

  • In the database, all the latest responses from all additional queries are stored as a single JSON blob.

What I propose is we treat additional queries whose names are prefixed with host_vital_ as custom vitals, which for our current purpose just means that we'll display them in the UI.

Benefits of this approach:

  • No backend changes needed -- just need to surface results from the additional object in the existing host API response. We'd use the first column of the first row, as suggested in the original design.
  • By namespacing the queries with a prefix, we can migrate them to another backend implementation later, which we'll likely want to do if we ever want to support filtering by this data
  • Casing (upper/lowercase) is maintained from the config to the keys used in the response, so for example host_vital_macOS_MAC_Address can be used to create a label of macOS MAC Address.
  • No agent changes needed -- this is all already supported, and will run at the same cadence as the detail queries that product built-in host vitals

Drawbacks to this approach:

  • No UI exists for this setting, so it would be via GitOps or API only. Certainly not ideal but in the interest of getting the customer need done now and iterating on it later, I'd hope this is an acceptable compromise.

Based on the parent ticket description and the Gong conversation, the main ask is to surface custom data on the host details pages, and this would fulfill that need. We can iterate on the UI for it in subsequent sprints, ideally while we gather more information on the full use case -- for instance, if multiple customers want to filter the hosts list by different vitals (custom or otherwise), that's a whole other thing that doesn't necessarily fit with the idea of pinning a query.

sgress454 avatar Nov 21 '25 01:11 sgress454

@rachaelshaw based on today's discussion I think we want to drop the link from the custom host vital value on the host page for this revision. Let me know if you want the custom vitals to display differently than default vitals in any other way.

sgress454 avatar Nov 25 '25 21:11 sgress454

@rachaelshaw, this is in ready to spec but still missing the first part of configuring the additional-queries using UI. Did we say we drop the UI part for it? If not, we need to add the design.

sharon-fdm avatar Dec 01 '25 15:12 sharon-fdm

Looking good @melpike! Dropped some feedback/suggestions on layout/copy: https://drive.google.com/file/d/1ydXssoe-Gx1WYCxWMctFm1IZ9SNEyPXX/view?usp=sharing

cc @rachaelshaw

noahtalerman avatar Dec 12 '25 16:12 noahtalerman

@noahtalerman @melpike one piece of feedback on the new layout:

With the smaller table, we're losing the "Performance impact" column. We may want to keep this information around because it reflect's the query's performance on the individual host, which could be useful for diagnosing issues: Image (The performance impact shown on the /queries page won't necessarily be the same, since that one is an average across all hosts running the query.)

Maybe we could display it on the host query report instead? We've got space for it above the table: Image

rachaelshaw avatar Dec 12 '25 17:12 rachaelshaw

Maybe we could display it on the host query report instead? We've got space for it above the table

@rachaelshaw great call! I like it

Up to @melpike

noahtalerman avatar Dec 12 '25 20:12 noahtalerman

@noahtalerman @rachaelshaw Thanks for reviewing! I like this new layout and +1 to adding the performance impact to the query report page. I'm gonna run with this and combine all the feedback.

melpike avatar Dec 15 '25 14:12 melpike

@melpike @rachaelshaw @noahtalerman Is there a video anywhere yet of this in action? Thanks. cc @harrisonravazzolo @spalmesano0

nonpunctual avatar Dec 17 '25 01:12 nonpunctual

Planning poker

lucasmrod avatar Dec 17 '25 23:12 lucasmrod

Queries at a glance, Navigating breeze like clouds, Efficiency dance.

fleet-release avatar Feb 06 '26 21:02 fleet-release