foundationdb icon indicating copy to clipboard operation
foundationdb copied to clipboard

General-purpose JSON output for CLI commands

Open brownleej opened this issue 5 years ago • 1 comments

When building other tools that wrap around FDB's CLI commands, we've hit a couple of general problems. The first problem is that parsing the status json output from the CLI can be error-prone, since the command isn't guaranteed to output a valid JSON document; it may output other information before outputting any JSON. The second problem is that commands beside status json don't provide machine-readable output. For instance, when running exclusion commands, the output is in text form, so running exclusions through other tools requires parsing the text in a way that is brittle to future changes. Could we consider having an option to request output in JSON form for most or all commands, in a separate stream from other output?

brownleej avatar Jan 16 '21 00:01 brownleej

I am working on exposing all management APIs(Issue: #2960 ) through the transaction interface via special keys(\xff\xff). For those not be able to do based on transactions, I added c functions for them. The work is nearly finished with only several commands to be added. After that, I will need to refactor fdbcli to based on C API thus we get rid of the version issues. This issue is different from what I am working on since this generally needs to refactor the output format of fdbcli. But we should have a meeting on how to refactor the fdbcli in general. For example, as described here, having a json output option for fdbcli. In general, I think having a general output format of fdbcli instead of the current one, which is user-defined output with no forced-format, is much better in many cases like testing. cc @xumengpanda

sfc-gh-clin avatar Jan 25 '21 21:01 sfc-gh-clin