DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: "Power, Ciara" <ciara.power@intel.com>,
	David Marchand <david.marchand@redhat.com>,
	Chengwen Feng <fengchengwen@huawei.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [PATCH v2] usertools: telemetry json support pretty print
Date: Fri, 14 Oct 2022 08:01:11 -0700	[thread overview]
Message-ID: <20221014080111.79c7c0bd@hermes.local> (raw)
In-Reply-To: <Y0ld0q09n8bUg6qM@bricha3-MOBL.ger.corp.intel.com>

On Fri, 14 Oct 2022 14:02:10 +0100
Bruce Richardson <bruce.richardson@intel.com> wrote:

> On Fri, Oct 14, 2022 at 12:44:33PM +0000, Power, Ciara wrote:
> > Hi Chengwen,
> >   
> > > -----Original Message-----
> > > From: David Marchand <david.marchand@redhat.com>
> > > Sent: Friday 14 October 2022 10:50
> > > To: Chengwen Feng <fengchengwen@huawei.com>
> > > Cc: thomas@monjalon.net; dev@dpdk.org; Power, Ciara
> > > <ciara.power@intel.com>
> > > Subject: Re: [PATCH v2] usertools: telemetry json support pretty print
> > > 
> > > On Fri, Oct 14, 2022 at 5:31 AM Chengwen Feng <fengchengwen@huawei.com>
> > > wrote:  
> > > >
> > > > Currently, the dpdk-telemetry.py show json in raw format, which is not
> > > > good for human reading.
> > > >
> > > > E.g. The command '/ethdev/xstats,0' will output:
> > > > {"/ethdev/xstats": {"rx_good_packets": 0, "tx_good_packets": 0,
> > > > "rx_good_bytes": 0, "tx_good_bytes": 0, "rx_missed_errors": 0,
> > > > "rx_errors": 0, "tx_errors": 0, "rx_mbuf_allocation_errors": 0,
> > > > "rx_q0_packets": 0,...}}
> > > >
> > > > This patch supports json pretty print by adding extra indent=4
> > > > parameter, so the same command will output:
> > > > {
> > > >     "/ethdev/xstats": {
> > > >         "rx_good_packets": 0,
> > > >         "tx_good_packets": 0,
> > > >         "rx_good_bytes": 0,
> > > >         "tx_good_bytes": 0,
> > > >         "rx_missed_errors": 0,
> > > >         "rx_errors": 0,
> > > >         "tx_errors": 0,
> > > >         "rx_mbuf_allocation_errors": 0,
> > > >         "rx_q0_packets": 0,
> > > >         ...
> > > >     }
> > > > }
> > > >
> > > > Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>  
> > > 
> > > It's indeed easier to read, but maybe 4 chars is too much.
> > > 2 chars seem enough to me.  
> > [CP] 
> > +1 on using 2 chars
> >   
> > > 
> > > In any case I like the idea:  
> 
> I like it too, for interactive use. However, we also have some hooks in the
> code for when the app is being run non-interactively i.e. from a script. In
> that case, we probably want the indent to be unused.
> 
> The function "handle_socket()" tracks if the output is a tty via the "prompt"
> variable. That could be passed through to the "read_socket()" call to
> optionally not-indent the output.
> 
> /Bruce

Convention in other tools is a -p flag for "pretty output"

  reply	other threads:[~2022-10-14 15:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14  2:33 [PATCH] " Chengwen Feng
2022-10-14  3:25 ` [PATCH v2] " Chengwen Feng
2022-10-14  9:50   ` David Marchand
2022-10-14 12:44     ` Power, Ciara
2022-10-14 13:02       ` Bruce Richardson
2022-10-14 15:01         ` Stephen Hemminger [this message]
2022-10-14 15:29           ` Bruce Richardson
2022-10-14 16:10             ` Morten Brørup
2022-10-17  7:56               ` fengchengwen
2022-10-17  7:41 ` [PATCH v3] usertools: telemetry pretty print in interactive mode Chengwen Feng
2022-10-17  9:15   ` Bruce Richardson
2022-10-31 15:16     ` Thomas Monjalon

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=20221014080111.79c7c0bd@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=bruce.richardson@intel.com \
    --cc=ciara.power@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=thomas@monjalon.net \
    /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).