status: add support for multiple output formats#1249
Open
psergee wants to merge 1 commit intotarantool:masterfrom
Open
status: add support for multiple output formats#1249psergee wants to merge 1 commit intotarantool:masterfrom
psergee wants to merge 1 commit intotarantool:masterfrom
Conversation
patapenka-alexey
approved these changes
Mar 3, 2026
Contributor
patapenka-alexey
left a comment
There was a problem hiding this comment.
Thank you for the patch! LGTM.
The status command now supports JSON and YAML output formats in addition to the existing table format. This change introduces a printer interface that separates output formatting logic from core status functionality. New --format CLI option allows users to get machine-readable output for automation purposes. Closes tarantool#1245 @TarantoolBot document Title: `tt status` supports JSON and YAML output formats The `tt status` command now supports multiple output formats: - Table format (default, human-readable) - JSON format (machine-readable, for automation) - YAML format (machine-readable, for automation) Usage: - `tt status` - default table output - `tt status --format=json` - JSON output - `tt status --format=yaml` - YAML output The JSON and YAML formats include all status information: - Instance name - Status (RUNNING, STOPPED, etc.) - PID (if running) - Mode (RW/RO) - Config status - Box status - Upstream status - Alerts (with severity levels) Example JSON output: ```json { "app:master": { "status": "RUNNING", "pid": 12345, "mode": "RW", "config": "ready", "box": "running", "upstream": "--", "alerts": [] } } ```
104136a to
24ef0a7
Compare
bigbes
requested changes
Mar 12, 2026
| }, | ||
| } | ||
|
|
||
| statusCmd.Flags().BoolVarP(&opts.Pretty, "pretty", "p", false, "pretty-print table") |
Collaborator
There was a problem hiding this comment.
Pretty flag is removed, but it doesn't documented
Comment on lines
+232
to
235
| printer.Print(instances) | ||
|
|
||
| return nil | ||
| } |
Collaborator
There was a problem hiding this comment.
Suggested change
| printer.Print(instances) | |
| return nil | |
| } | |
| return printer.Print(instances) | |
| } |
|
|
||
| err = status.Status(runningCtx, opts) | ||
| var printer status.InstanceStatusPrinter | ||
| switch opts.format { |
Collaborator
There was a problem hiding this comment.
Alerts (details) are always enabled in "json/yaml" printer?
| import ( | ||
| "fmt" | ||
|
|
||
| "gopkg.in/yaml.v2" |
Collaborator
There was a problem hiding this comment.
Since this is new file - let's use yaml.v3 here.
Comment on lines
+13
to
+14
| // StatusOpts contains options for tt status. | ||
| type statusOpts struct { |
Contributor
There was a problem hiding this comment.
Suggested change
| // StatusOpts contains options for tt status. | |
| type statusOpts struct { | |
| // statusOpts contains options for tt status. | |
| type statusOpts struct { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The status command now supports JSON and YAML output formats in addition to the existing table format. This change introduces a printer interface that separates output formatting logic from core status functionality.
New --format CLI option allows users to get machine-readable output for automation purposes.
Closes #1245
@TarantoolBot document
Title:
tt statussupports JSON and YAML output formatsThe
tt statuscommand now supports multiple output formats:Usage:
tt status- default table outputtt status --format=json- JSON outputtt status --format=yaml- YAML outputThe JSON and YAML formats include all status information:
Example JSON output:
{ "app:master": { "status": "RUNNING", "pid": 12345, "mode": "RW", "config": "ready", "box": "running", "upstream": "--", "alerts": [] } }