-
Notifications
You must be signed in to change notification settings - Fork 939
Add support for displaying instance tags when printing a cluster's topology #941
Description
I would like the option to print the topology of a cluster and have the tags associated with each instance be printed on the same line as the instance itself. There are existing commands for fetching the tags for a particular instance but not any for fetching the tags for all instances in a cluster and displaying them with the topology.
There are commands "topology" and "topology-tabulated", but these do not print the tags associated with an instance. I would like to add a flag to existing commands or add a new command which is able to print a topology but also the tags which exist for each instance.
An example of how the command would behave, but first display the topology and set up instance tags:
$ orchestrator -c topology -i testhost:22293
testhost:22293 [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID]
- testhost:22294 [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID]
- testhost:22295 [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID]
- testhost:22296 [unknown,unchecked,5.6.28,rw,nobinlog,P-GTID]
- testhost:22297 [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID]
$ orchestrator -c tag -i testhost:22293 -t in_service
$ orchestrator -c tag -i testhost:22293 -t role=backup
$ orchestrator -c tag -i testhost:22294 -t role=delayed
$ orchestrator -c tag -i testhost:22295 -t in_service
# The command which I am proposing, here I call it "topology-tags"
$ orchestrator -c topology-tags -i testhost:22295
testhost:22293 [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID] [in_service,role=backup]
- testhost:22294 [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID] [role=delayed]
- testhost:22295 [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID] [in_service]
- testhost:22296 [unknown,unchecked,5.6.28,rw,nobinlog,P-GTID] []
- testhost:22297 [unknown,unchecked,5.6.28-log,rw,STATEMENT,>>,P-GTID] []
I propose that tags are printed in brackets after the metadata information, with each tag separated by a comma. Tags without values are printed as only the name of the tag and with no value.
I will be submitting a PR which implements this proposal and am open to discussing modifications of the text formatting.