[DISCUSS] Simplfied sensuctl resource list output? #3667
Labels
component:sensuctl
Sensu CLI improvements
enhancement
Major version proposal
Breaking changes for the next major version of Sensu Go
Milestone
Feature Suggestion
One of my favorite features in Sensu Go is the new
sensuctl
CLI utility. It's a natural fit alongside the other modern ops tools in my workflow (e.g.kubectl
,docker
, etc). Having said that, the more complex my Sensu Go deployments become, the more cumbersome thesensuctl <resource> list
views become (see screenshot, below).So this got me thinking about workflows, and the way I use
sensuctl
. I think my most common workflow withsensuctl
is to use asensuctl <resource> list
command to lookup a given resource (where the most important detail I need is the resource name). From there I usually run asensuctl <resource> info <resource_name>
command, optionally passing a--format yaml
or--format json
flag to get machine-parseable output (or to pipe/copy a resource template to a file where I can edit it for another use case).Example
Entity list command output is less cumbersome than the check list command output (as shown in the earlier screenshot, above), but that also adds a degree of confusion. Is there any rhyme or reason to what resource attributes we show in these outputs? In some cases the
sensuctl <resource> list
command output is the same as the correspondingsensuctl <resource> info
command output; in others the outputs differ with regards to the resource attributes that are displayed. And the JSON/YAML format output just show everything. This has got me asking myself the question: what is the purpose of these CLI features/functions?I propose we adopt the following guidelines for
sensuctl <resource> list
andsensuctl <resource> info
command outputs:sensuctl <resource> list
: outputs resource names and (optionally) up to three primary/key attributes.sensuctl <resource> info <resource_name>
: outputs the complete resource definition for a given resource name (i.e.type
,api_version
,metadata
, andspec
).If this proposal successfully achieves its goal, it should help improve the consistency of
sensuctl <resource> list
andsensuctl <resource> info
command outputs, and simplify thesensuctl
UX – imagine if everysensuctl <resource> list
command only displayed the most pertinent information (beginning with the resource names).😍
It should also make contributions easier to reason about by reducing the number of decisions to make – not every new feature or resource attribute needs to be added to list views! List command output will only require resource names and up to three key attributes (e.g. for checks those key attributes might be
publish
,interval
, andsubscriptions
); is a new check feature/attribute more important to show in a list view than thepublish
/interval
/subscriptions
attributes ??? (HINT: probably not). And since info command output should include everything, should we even need to update the output function(s) when we add new attributes?NOTE: we may need to implement support for redacting certain attribute values in
sensuctl <resource> info
command output.Possible Implementation
TBD, but I suspect that this could help simplify the
sensuctl
code, since it seems that there may be one-off functions in use between the different resources forsensuctl <resource> info --format tabular
output (because it seems that only a certain subset of attributes are being output per resource)? Would "printing everything" make things easier here?Context
Let's make
sensuctl
easier to use!Related: let's update the layout/format of
sensuctl
command output!The text was updated successfully, but these errors were encountered: