Skip to content

[PWCI] "telemetry: fix adding dicts in container arrays"#603

Open
ovsrobot wants to merge 1 commit intomainfrom
series_36982
Open

[PWCI] "telemetry: fix adding dicts in container arrays"#603
ovsrobot wants to merge 1 commit intomainfrom
series_36982

Conversation

@ovsrobot
Copy link
Owner

@ovsrobot ovsrobot commented Jan 7, 2026

NOTE: This is an auto submission for "telemetry: fix adding dicts in container arrays".

See "http://patchwork.dpdk.org/project/dpdk/list/?series=36982" for details.

Summary by Sourcery

Bug Fixes:

  • Fix telemetry array container type validation so that arrays of dictionaries are accepted as valid contents.

Summary by CodeRabbit

  • Bug Fixes
    • Expanded telemetry data collection capabilities to support additional data types in container operations, enabling more flexible data organization and reporting.

✏️ Tip: You can customize this high-level summary in your review settings.

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: c933bb5 ("telemetry: support array values in data object")

Signed-off-by: Robin Jarry <rjarry@redhat.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
@sourcery-ai
Copy link

sourcery-ai bot commented Jan 7, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Extends telemetry array-container validation to allow nested dictionary-type telemetry data as entries in container arrays while preserving existing type and bounds checks.

File-Level Changes

Change Details Files
Allow TEL_DICT telemetry data to be added into TEL_ARRAY_CONTAINER arrays.
  • Adjusted the type validation condition in rte_tel_data_add_array_container to accept TEL_DICT in addition to the existing array types
  • Kept the early returns for invalid types and array capacity limits unchanged to preserve previous behavior aside from the new allowed type
lib/telemetry/telemetry_data.c

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

Extends the validation logic in rte_tel_data_add_array_container to accept TEL_DICT as an additional value type alongside existing TEL_ARRAY_UINT, TEL_ARRAY_INT, and TEL_ARRAY_STRING types. No public interface changes or functional behavior alterations beyond broadened type acceptance.

Changes

Cohort / File(s) Summary
Telemetry Data Type Validation
lib/telemetry/telemetry_data.c
Modified type validation condition to permit TEL_DICT when adding a container to an existing array container; adjusted validation check from supporting 3 specific array types to supporting 4 types including dictionary

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A rabbit hopped through telemetry arrays with glee,
Finding dicts now welcome in the container tree! 🐰
Three types became four, oh what a delight,
Validation expanded, the logic stays tight.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: enabling dict containers within array containers in the telemetry module.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @lib/telemetry/telemetry_data.c:
- Around line 99-102: The change in rte_tel_data_add_array_container now permits
TEL_DICT as an array value type but there is no unit test covering an array
whose elements are TEL_DICT; add a test in app/test/test_telemetry_data.c that
constructs an array container via rte_tel_data_add_array_container with
val->type == TEL_DICT (use the same creation helpers used for existing array
tests), insert one or more dict elements into the array, call
container_to_json() (or the public serialization path exercised by other tests)
and assert the produced JSON matches the expected nested structure to ensure the
JSON formatter handles TEL_DICT-in-array cases.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd60dcd and 8df7cfa.

📒 Files selected for processing (1)
  • lib/telemetry/telemetry_data.c
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Sourcery review

Comment on lines +99 to +102
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))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

echo "=== Searching for JSON formatter code that handles array containers ==="
rg -n -C 3 'TEL_ARRAY_CONTAINER' --type c

echo -e "\n=== Searching for test files related to telemetry array containers ==="
fd -e c test.*telemetry 2>/dev/null || echo "No matches for test.*telemetry"
fd -e c telemetry.*test 2>/dev/null || echo "No matches for telemetry.*test"
fd -type f -name "*test*" -path "*/telemetry/*" 2>/dev/null | head -20

echo -e "\n=== Checking for existing tests of rte_tel_data_add_array_container ==="
rg -n 'rte_tel_data_add_array_container' --type c

Repository: ovsrobot/dpdk

Length of output: 3959


🏁 Script executed:

#!/bin/bash

echo "=== Examining test cases that use rte_tel_data_add_array_container ==="
sed -n '155,170p' app/test/test_telemetry_data.c

echo -e "\n=== Checking what types child_data and child_data2 are ==="
sed -n '140,165p' app/test/test_telemetry_data.c

echo -e "\n=== Looking at JSON formatter processing of array containers (lines 346-360) ==="
sed -n '346,370p' lib/telemetry/telemetry.c

echo -e "\n=== Searching for TEL_DICT handling in JSON formatter ==="
rg -n 'TEL_DICT' lib/telemetry/telemetry.c -C 3

echo -e "\n=== Checking if rte_tel_data_add_dict_container exists and what it does ==="
rg -n -A 10 'rte_tel_data_add_dict_container' lib/telemetry/telemetry_data.c | head -40

Repository: ovsrobot/dpdk

Length of output: 3644


LGTM. Change correctly aligns validation with JSON formatter and existing dict container function.

The modification appropriately extends rte_tel_data_add_array_container to accept TEL_DICT alongside existing array types, making it consistent with rte_tel_data_add_dict_container (lines 232-235). The JSON formatter's container_to_json() function already recursively processes all container types, including TEL_DICT, so the infrastructure is in place.

Note: Existing tests in app/test/test_telemetry_data.c verify array containers with array value types, but don't explicitly test the newly-enabled TEL_DICT as a value type within array containers. Consider adding a test case for this scenario.

🤖 Prompt for AI Agents
In @lib/telemetry/telemetry_data.c around lines 99 - 102, The change in
rte_tel_data_add_array_container now permits TEL_DICT as an array value type but
there is no unit test covering an array whose elements are TEL_DICT; add a test
in app/test/test_telemetry_data.c that constructs an array container via
rte_tel_data_add_array_container with val->type == TEL_DICT (use the same
creation helpers used for existing array tests), insert one or more dict
elements into the array, call container_to_json() (or the public serialization
path exercised by other tests) and assert the produced JSON matches the expected
nested structure to ensure the JSON formatter handles TEL_DICT-in-array cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants