* [PATCH] telemetry: correct json empty dictionaries
@ 2023-12-18 21:47 Jonathan Erb
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Erb @ 2023-12-18 21:47 UTC (permalink / raw)
To: ciara.power; +Cc: dev, Jonathan Erb
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..a3302ba7a1 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 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..0788a32210 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 == RTE_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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] telemetry: correct json empty dictionaries
@ 2023-12-24 22:02 Jonathan Erb
2024-01-18 17:26 ` [PATCH] " Jonathan Erb
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Erb @ 2023-12-24 22:02 UTC (permalink / raw)
To: ciara.power; +Cc: dev, Jonathan Erb
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..a3302ba7a1 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 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..0788a32210 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 == RTE_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
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] telemetry: correct json empty dictionaries
2023-12-24 22:02 [PATCH v2 1/2] " Jonathan Erb
@ 2024-01-18 17:26 ` Jonathan Erb
2024-01-19 9:56 ` Power, Ciara
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jonathan Erb @ 2024-01-18 17:26 UTC (permalink / raw)
To: ciara.power; +Cc: dev, bruce.richardson, Jonathan Erb
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] telemetry: correct json empty dictionaries
2024-01-18 17:26 ` [PATCH] " Jonathan Erb
@ 2024-01-19 9:56 ` Power, Ciara
2024-02-01 11:57 ` David Marchand
2024-02-12 10:15 ` David Marchand
2 siblings, 0 replies; 6+ messages in thread
From: Power, Ciara @ 2024-01-19 9:56 UTC (permalink / raw)
To: Jonathan Erb; +Cc: dev, Richardson, Bruce
> -----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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] telemetry: correct json empty dictionaries
2024-01-18 17:26 ` [PATCH] " Jonathan Erb
2024-01-19 9:56 ` Power, Ciara
@ 2024-02-01 11:57 ` David Marchand
2024-02-02 14:04 ` Jonathan Erb
2024-02-12 10:15 ` David Marchand
2 siblings, 1 reply; 6+ messages in thread
From: David Marchand @ 2024-02-01 11:57 UTC (permalink / raw)
To: Jonathan Erb; +Cc: ciara.power, dev, bruce.richardson
On Fri, Jan 19, 2024 at 8:48 AM Jonathan Erb <jonathan.erb@threater.com> wrote:
>
> 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>
Thanks for the fix.
Could you point at the change that introduced this issue?
I will add the Fixes: tag when applying.
--
David Marchand
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] telemetry: correct json empty dictionaries
2024-02-01 11:57 ` David Marchand
@ 2024-02-02 14:04 ` Jonathan Erb
0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Erb @ 2024-02-02 14:04 UTC (permalink / raw)
To: David Marchand; +Cc: ciara.power, dev, bruce.richardson
David,
It was just a minor oversight in following commit:
commit c933bb5177cac5fbf4533e357d466cff1f3e6c97
Author: Ciara Power <ciara.power@intel.com>
Date: Wed Sep 23 12:12:26 2020 +0100
telemetry: support array values in data object
Arrays of type uint64_t/int/string can now be included within an array
or dict. One level of embedded containers is supported. This is
necessary to allow for instances such as the ethdev queue stats to be
reported as a list of uint64_t values, rather than having multiple dict
entries with one uint64_t value for each queue stat.
The memory management APIs provided by telemetry simplify the memory
allocation/free aspect of the embedded container. The
rte_tel_data_alloc
function is called in the library/app callback to return a pointer to a
container that has been allocated memory. When adding this container
to an array/dict, a parameter is passed to indicate if the memory
should be freed by telemetry after use. This will allow reuse of the
allocated memory if the library/app wishes to do so.
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
On 2/1/24 06:57, David Marchand wrote:
> On Fri, Jan 19, 2024 at 8:48 AM Jonathan Erb <jonathan.erb@threater.com> wrote:
>> 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>
> Thanks for the fix.
> Could you point at the change that introduced this issue?
>
> I will add the Fixes: tag when applying.
>
>
--
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] telemetry: correct json empty dictionaries
2024-01-18 17:26 ` [PATCH] " Jonathan Erb
2024-01-19 9:56 ` Power, Ciara
2024-02-01 11:57 ` David Marchand
@ 2024-02-12 10:15 ` David Marchand
2 siblings, 0 replies; 6+ messages in thread
From: David Marchand @ 2024-02-12 10:15 UTC (permalink / raw)
To: Jonathan Erb; +Cc: ciara.power, dev, bruce.richardson
On Fri, Jan 19, 2024 at 8:48 AM Jonathan Erb <jonathan.erb@threater.com> wrote:
>
> 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.
>
Fixes: c933bb5177ca ("telemetry: support array values in data object")
Cc: stable@dpdk.org
> Signed-off-by: Jonathan Erb <jonathan.erb@threater.com>
Acked-by: Ciara Power <ciara.power@intel.com>
Applied thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-02-12 10:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-18 21:47 [PATCH] telemetry: correct json empty dictionaries Jonathan Erb
2023-12-24 22:02 [PATCH v2 1/2] " Jonathan Erb
2024-01-18 17:26 ` [PATCH] " Jonathan Erb
2024-01-19 9:56 ` Power, Ciara
2024-02-01 11:57 ` David Marchand
2024-02-02 14:04 ` Jonathan Erb
2024-02-12 10:15 ` David Marchand
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).