Re: [PATCH dpdk] telemetry: fix adding dicts in container arrays

Bruce Richardson
2026-01-08T09:20:33Z

On Wed, Jan 07, 2026 at 10:51:30PM +0100, Robin Jarry wrote:
> Currently, adding TEL_DICT containers in TEL_ARRAY_CONTAINER containers
> is not supported by rte_tel_data_add_array_container. It wrongfully
> returns -EINVAL where it should allow it.
>
> This is supported by the JSON formatter.
>
> Allow the same value types than rte_tel_data_add_dict_container().
>
> Fixes: c933bb5177ca ("telemetry: support array values in data object")
>
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---
> lib/telemetry/telemetry_data.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c
> index 0354a0654804..0a006559ab42 100644
> --- a/lib/telemetry/telemetry_data.c
> +++ b/lib/telemetry/telemetry_data.c
> @@ -96,10 +96,10 @@ int
> rte_tel_data_add_array_container(struct rte_tel_data *d,
> struct rte_tel_data *val, int keep)
> {
> - if (d->type != TEL_ARRAY_CONTAINER ||
> - (val->type != TEL_ARRAY_UINT
> + if (d->type != TEL_ARRAY_CONTAINER || (val->type != TEL_ARRAY_UINT
> && val->type != TEL_ARRAY_INT
> - && val->type != TEL_ARRAY_STRING))
> + && val->type != TEL_ARRAY_STRING
> + && val->type != TEL_DICT))
> return -EINVAL;
> if (d->data_len >= RTE_TEL_MAX_ARRAY_ENTRIES)
> return -ENOSPC;
> --

No objection to this, but previous implementation limited the options to
what was needed and tested by telemetry rather than trying to cover every
eventuality. If we now support dicts in arrays, please add some unit
testing around it to verify we haven't any issues with it.

Thanks,
/Bruce