Unified --Json output#6419
Conversation
|
What the Json output would look like for `accumulo inst service-status --json {
"command": "accumulo admin service-status",
"version": "1.0",
"reportTime": "2026-06-09T20:20:01Z",
"status": "OK",
"data": {
"reportTime": "2026-06-09T20:20:01.889Z",
"zkReadErrors": 0,
"showHosts": false,
"summaries": {
"COMPACTOR": {
"resourceGroups": {
"default": 1
},
"serviceByGroups": {
"default": [
"localhost:9600"
]
},
"serviceCount": 1,
"errorCount": 0
},
"GC": {
"resourceGroups": {
"default": 1
},
"serviceByGroups": {
"default": [
"localhost:9998"
]
},
"serviceCount": 1,
"errorCount": 0
},
"MANAGER": {
"resourceGroups": {
"default": 1
},
"serviceByGroups": {
"default": [
"localhost:9999"
]
},
"serviceCount": 1,
"errorCount": 0
},
"MONITOR": {
"resourceGroups": {
"default": 1
},
"serviceByGroups": {
"default": [
"localhost:9995"
]
},
"serviceCount": 1,
"errorCount": 0
},
"S_SERVER": {
"resourceGroups": {
"default": 1
},
"serviceByGroups": {
"default": [
"localhost:9700"
]
},
"serviceCount": 1,
"errorCount": 0
},
"T_SERVER": {
"resourceGroups": {
"default": 1
},
"serviceByGroups": {
"default": [
"localhost:9800"
]
},
"serviceCount": 1,
"errorCount": 0
}
}
}
} |
DomGarguilo
left a comment
There was a problem hiding this comment.
Trying out some commands and things are looking good. I did find one discrepency that I think is caused by these changes. I tried accumulo inst service-status --json and realized the serviceByGroups field is printed even though it only should be when --showHosts is provided too. I think the logic that excludes that field from the output is broken now since the new envelope code serializes the ServiceStatusReport object directly instead of using its existing toJson() method. Probably need to update ServiceStatusReport.getData()
| + " Expected format: -o <key>=<value> [-o <key>=<value>]") | ||
| private List<String> overrides = new ArrayList<>(); | ||
|
|
||
| @Parameter(names = {"-j", "--json"}, |
There was a problem hiding this comment.
Searched the project and the ListCompactions command has this -j/--json option already. Should probably remove that and let it read the inherited options.json instead
addresses issue #6391
To make a universal
--jsonflag I moved it fromFateandServiceStatusand intoServerOptsso all commands inherit it. Added a newCommandOutputEnvelopeclass that will take accumulo JSON outputs and wraps them in an envelope for a unified output and a newCommandReportinterface that report classes will inherit so they can produce both human-readable and computer readable lines. Started by wiring upfate --summaryandservice-statusas the two proof-of-concept commands since both already have partial JSON support