DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] usertools: telemetry json support pretty print
@ 2022-10-14  2:33 Chengwen Feng
  2022-10-14  3:25 ` [PATCH v2] " Chengwen Feng
  2022-10-17  7:41 ` [PATCH v3] usertools: telemetry pretty print in interactive mode Chengwen Feng
  0 siblings, 2 replies; 12+ messages in thread
From: Chengwen Feng @ 2022-10-14  2:33 UTC (permalink / raw)
  To: thomas; +Cc: dev, ciara.power

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 outupt:
{"/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>
---
 usertools/dpdk-telemetry.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py
index a81868a547..315f78fb8f 100755
--- a/usertools/dpdk-telemetry.py
+++ b/usertools/dpdk-telemetry.py
@@ -33,7 +33,7 @@ def read_socket(sock, buf_len, echo=True):
         sock.close()
         raise
     if echo:
-        print(json.dumps(ret))
+        print(json.dumps(ret, indent=4))
     return ret
 
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-10-31 15:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-14  2:33 [PATCH] usertools: telemetry json support pretty print 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
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

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).