From: "Power, Ciara" <ciara.power@intel.com>
To: Jonathan Erb <jonathan.erb@threater.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"Richardson, Bruce" <bruce.richardson@intel.com>
Subject: RE: [PATCH] telemetry: correct json empty dictionaries
Date: Fri, 19 Jan 2024 09:56:23 +0000 [thread overview]
Message-ID: <SN7PR11MB763932FBA266E4EB6972D41CE6702@SN7PR11MB7639.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20240118172602.898004-1-jonathan.erb@threater.com>
> -----Original Message-----
> From: Jonathan Erb <jonathan.erb@threater.com>
> Sent: Thursday, January 18, 2024 5:26 PM
> To: Power, Ciara <ciara.power@intel.com>
> Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>;
> Jonathan Erb <jonathan.erb@threater.com>
> Subject: [PATCH] telemetry: correct json empty dictionaries
>
> Fix to allow telemetry to handle empty dictionaries correctly.
>
> This patch resolves an issue where empty dictionaries are reported by
> telemetry as '[]' rather than '{}'. Initializing the output buffer based on the
> container type resolves the issue.
>
> Signed-off-by: Jonathan Erb <jonathan.erb@threater.com>
> ---
> .mailmap | 2 +-
> lib/telemetry/telemetry.c | 6 +++++-
> 2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/.mailmap b/.mailmap
> index ab0742a382..a6b66ab3ad 100644
> --- a/.mailmap
> +++ b/.mailmap
> @@ -675,7 +675,7 @@ John Ousterhout <ouster@cs.stanford.edu> John
> Romein <romein@astron.nl> John W. Linville <linville@tuxdriver.com> Jonas
> Pfefferle <jpf@zurich.ibm.com> <pepperjo@japf.ch> -Jonathan Erb
> <jonathan.erb@threatblockr.com> <jonathan.erb@banduracyber.com>
> +Jonathan Erb <jonathan.erb@threater.com>
> +<jonathan.erb@threatblockr.com> <jonathan.erb@banduracyber.com>
> Jonathan Tsai <jonathan1.tsai@intel.com> Jon DeVree <nuxi@vault24.org>
> Jon Loeliger <jdl@netgate.com> diff --git a/lib/telemetry/telemetry.c
> b/lib/telemetry/telemetry.c index 92982842a8..eef4ac7bb7 100644
> --- a/lib/telemetry/telemetry.c
> +++ b/lib/telemetry/telemetry.c
> @@ -169,7 +169,11 @@ container_to_json(const struct rte_tel_data *d, char
> *out_buf, size_t buf_len)
> d->type != TEL_ARRAY_INT && d->type !=
> TEL_ARRAY_STRING)
> return snprintf(out_buf, buf_len, "null");
>
> - used = rte_tel_json_empty_array(out_buf, buf_len, 0);
> + if (d->type == TEL_DICT)
> + used = rte_tel_json_empty_obj(out_buf, buf_len, 0);
> + else
> + used = rte_tel_json_empty_array(out_buf, buf_len, 0);
> +
> if (d->type == TEL_ARRAY_UINT)
> for (i = 0; i < d->data_len; i++)
> used = rte_tel_json_add_array_uint(out_buf,
> --
> 2.34.1
Acked-by: Ciara Power <ciara.power@intel.com>
next prev parent reply other threads:[~2024-01-19 9:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-24 22:02 [PATCH v2 1/2] " Jonathan Erb
2023-12-24 22:02 ` [PATCH v2 2/2] " Jonathan Erb
2024-01-08 11:02 ` Bruce Richardson
2024-01-08 11:01 ` [PATCH v2 1/2] " Bruce Richardson
2024-01-10 17:49 ` Power, Ciara
2024-01-18 17:26 ` [PATCH] " Jonathan Erb
2024-01-19 9:56 ` Power, Ciara [this message]
2024-02-01 11:57 ` David Marchand
2024-02-02 14:04 ` Jonathan Erb
2024-02-12 10:15 ` David Marchand
-- strict thread matches above, loose matches on Subject: below --
2023-12-18 21:47 Jonathan Erb
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=SN7PR11MB763932FBA266E4EB6972D41CE6702@SN7PR11MB7639.namprd11.prod.outlook.com \
--to=ciara.power@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=jonathan.erb@threater.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).