linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Sidong Yang <realwakka@gmail.com>
Cc: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] btrfs-progs: device stats: add json output format
Date: Fri, 30 Oct 2020 18:55:25 +0100	[thread overview]
Message-ID: <20201030175525.GZ6756@twin.jikos.cz> (raw)
In-Reply-To: <20201004112557.5568-1-realwakka@gmail.com>

On Sun, Oct 04, 2020 at 11:25:57AM +0000, Sidong Yang wrote:
> Add supports for json formatting, this patch changes hard coded printing
> code to formatted print with output formatter. Json output would be
> useful for other programs that parse output of the command. but it
> changes the text format.
> 
> Example text format:
> 
> device:                 /dev/vdb
> write_io_errs:          0
> read_io_errs:           0
> flush_io_errs:          0
> corruption_errs:        0
> generation_errs:        0
> 
> Example json format:
> 
> {
>   "__header": {
>     "version": "1"
>   },
>   "device-stats": {
>     "/dev/vdb": {
>       "device": "/dev/vdb",
>       "write_io_errs": "0",
>       "read_io_errs": "0",
>       "flush_io_errs": "0",
>       "corruption_errs": "0",
>       "generation_errs": "0"
>     }
>   },
> }

The overall structure looks good, ie. the separate object 'device-stats'
and then the contents. For that the device id should be either key to a
map, or we can put it into an array (where device id must be present
too).

A check if the format is usable you can try to write a sample tool that
parses some of the data and prints them. So eg. using python or jq and
print stats of device 1. Which points out that device id is missing for
example.

  reply	other threads:[~2020-10-30 17:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-04 11:25 [PATCH v2] btrfs-progs: device stats: add json output format Sidong Yang
2020-10-30 17:55 ` David Sterba [this message]
2020-11-01  3:26   ` Sidong Yang
2020-11-01 21:24   ` Sidong Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201030175525.GZ6756@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=realwakka@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).