Skip to content

Conversation

edsiper
Copy link
Member

@edsiper edsiper commented Oct 19, 2025

Add cobj_group_metadata and cobj_group_attributes to flb_mp_chunk_record to give processors access to shared group context alongside individual record data. This enables processors to read and modify OpenTelemetry
resource attributes and scope metadata using the CFL object interface.


Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • New Features

    • Log processing now preserves and propagates group-level metadata and attributes alongside individual records; group context can be used as record payload for group-start events and is tracked across consecutive records.
  • Tests

    • Added internal unit tests that emit and decode grouped events end-to-end, verifying group identifiers, resource types, attribute mutation, round-trip encoding, and proper cleanup.

Copy link

coderabbitai bot commented Oct 19, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "mp: extend cobj API to expose group metadata and attributes" accurately and concisely describes the main change in the changeset. The changes add new struct fields (cobj_group_metadata, cobj_group_attributes, and related ownership flags) to enable processors to access group context data through the CFL object interface, along with implementation logic in the encoding/decoding paths and comprehensive unit tests. The title is specific, clear, and correctly identifies the primary objective of extending the cobj API to expose group metadata and attributes, making it easy for reviewers to understand the core purpose of the changeset.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch cobj_groups

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dee9e19 and 062e4eb.

📒 Files selected for processing (5)
  • include/fluent-bit/flb_mp_chunk.h (2 hunks)
  • src/flb_mp.c (9 hunks)
  • tests/internal/CMakeLists.txt (1 hunks)
  • tests/internal/log_event_decoder.c (1 hunks)
  • tests/internal/mp_chunk_cobj.c (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/internal/CMakeLists.txt
  • tests/internal/log_event_decoder.c
🧰 Additional context used
🧬 Code graph analysis (2)
tests/internal/mp_chunk_cobj.c (7)
src/flb_log_event_encoder.c (8)
  • flb_log_event_encoder_create (76-97)
  • flb_log_event_encoder_group_init (390-407)
  • flb_log_event_encoder_group_header_end (409-419)
  • flb_log_event_encoder_begin_record (246-254)
  • flb_log_event_encoder_set_timestamp (276-287)
  • flb_log_event_encoder_commit_record (256-274)
  • flb_log_event_encoder_group_end (421-443)
  • flb_log_event_encoder_destroy (99-116)
include/fluent-bit/flb_time.h (1)
  • flb_time_set (75-79)
src/flb_log_event_decoder.c (6)
  • flb_log_event_decoder_init (99-116)
  • flb_log_event_decoder_read_groups (85-97)
  • flb_log_event_decoder_get_record_type (408-428)
  • flb_log_event_decoder_next (310-406)
  • flb_log_event_decoder_get_last_result (300-308)
  • flb_log_event_decoder_destroy (147-179)
src/flb_mp.c (5)
  • flb_mp_chunk_cobj_create (1065-1087)
  • flb_mp_chunk_cobj_record_next (1243-1435)
  • flb_mp_chunk_cobj_encode (1106-1207)
  • flb_mp_object_to_cfl (899-934)
  • flb_mp_chunk_cobj_destroy (1209-1241)
lib/cfl/src/cfl_kvlist.c (2)
  • cfl_kvlist_fetch (418-421)
  • cfl_kvlist_insert_int64 (376-380)
lib/cfl/src/cfl_object.c (1)
  • cfl_object_destroy (95-106)
include/fluent-bit/flb_mem.h (1)
  • flb_free (126-128)
src/flb_mp.c (3)
lib/cfl/src/cfl_object.c (1)
  • cfl_object_destroy (95-106)
src/flb_log_event_decoder.c (1)
  • flb_log_event_decoder_get_record_type (408-428)
include/fluent-bit/flb_mem.h (1)
  • flb_free (126-128)
⏰ 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). (30)
  • GitHub Check: pr-windows-build / call-build-windows-package (Windows 64bit (Arm64), amd64_arm64, -DCMAKE_SYSTEM_NAME=Windows -DCMA...
  • GitHub Check: pr-windows-build / call-build-windows-package (Windows 64bit, x64, x64-windows-static, 3.31.6)
  • GitHub Check: pr-windows-build / call-build-windows-package (Windows 32bit, x86, x86-windows-static, 3.31.6)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_ARROW=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_COVERAGE=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, gcc, g++)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, clang, clang++, ubuntu-22.04, clang-12)
  • GitHub Check: pr-compile-without-cxx (3.31.6)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, clang, clang++, ubuntu-24.04, clang-14)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, gcc, g++, ubuntu-22.04, clang-12)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, gcc, g++, ubuntu-24.04, clang-14)
  • GitHub Check: pr-compile-centos-7
  • GitHub Check: PR - fuzzing test
🔇 Additional comments (13)
include/fluent-bit/flb_mp_chunk.h (2)

39-42: LGTM: Group metadata and attributes fields added correctly.

The new fields for group-level metadata and attributes are properly integrated into the record structure. The ownership flags will help manage memory correctly.


54-55: LGTM: Active group tracking fields added.

These fields enable the chunk to track the currently active group's metadata and attributes across multiple records, which is essential for the group context sharing functionality.

tests/internal/mp_chunk_cobj.c (2)

186-290: LGTM: Group metadata modification logic is correct.

The test correctly validates that:

  1. Group metadata and attributes are accessible on both GROUP_START and NORMAL records
  2. Modifications to group metadata on NORMAL records (lines 259-264, 276) persist because they share the same underlying objects with GROUP_START records
  3. The shared-pointer semantics work as intended

386-411: LGTM: Thorough cleanup in all paths.

All allocated resources are properly freed in the cleanup section, and the decoder ready flags ensure decoders are only destroyed if successfully initialized.

src/flb_mp.c (9)

1057-1060: LGTM: Group fields initialized correctly.

The new group metadata/attributes fields and ownership flags are properly initialized to NULL/FALSE in the record creation function.


1083-1084: LGTM: Active group tracking initialized.

The chunk's active group pointers are correctly initialized to NULL.


1133-1145: LGTM: Record type detection is correct.

The logic correctly infers record type from the timestamp field, distinguishing between NORMAL, GROUP_START, and GROUP_END records.


1227-1234: LGTM: Avoid double-free with ownership checks.

The destruction logic correctly checks ownership flags and ensures group objects aren't destroyed if they're the same as the record's primary metadata/record objects (preventing double-free).


1295-1321: LGTM: Group ownership and pointer sharing logic is correct.

The logic properly handles three record types:

  • GROUP_START: Takes ownership of group objects (aliased to metadata/record)
  • GROUP_END: References active group objects without ownership
  • NORMAL: References active group objects without ownership

The shared-pointer semantics enable processors to modify group context via any record in the group.


1323-1361: LGTM: On-demand group object creation with proper error cleanup.

The fallback logic converts event-level group_metadata and group_attributes from msgpack to CFL objects when needed, with comprehensive error handling that cleans up partially allocated resources (lines 1329-1335, 1349-1355).


1456-1463: LGTM: Active group references cleared correctly.

When destroying a record that owns group objects, the chunk's active group pointers are cleared to prevent dangling references.


1471-1478: LGTM: Group object cleanup avoids double-free.

The cleanup checks both ownership flags and pointer equality to prevent destroying the same object twice when group objects are aliased to the record's primary objects.


1168-1186: Code implementation is correct; pointer sharing and modification propagation work as described.

After examining the implementation, the review comment's analysis is verified as accurate:

  • GROUP_START records correctly set cobj_group_attributes = cobj_record and store in chunk_cobj->active_group_attributes (line 1308)
  • NORMAL records correctly reference the same pointer: cobj_group_attributes = chunk_cobj->active_group_attributes (line 1318)
  • Encoding logic correctly uses record->cobj_group_attributes for GROUP_START bodies (line 1170)

The shared pointer mechanism ensures that modifications to a NORMAL record's group attributes will propagate to GROUP_START records' cobj_record, as claimed. The implementation is sound.

The unit test binary could not be executed in the sandbox environment (no build system available), but the code review analysis holds based on static inspection of the implementation.


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

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

src/flb_mp.c Outdated
Comment on lines 1257 to 1273
if (record->event.group_metadata &&
(record->event.group_metadata->type == MSGPACK_OBJECT_MAP ||
record->event.group_metadata->type == MSGPACK_OBJECT_ARRAY)) {
record->cobj_group_metadata = flb_mp_object_to_cfl(record->event.group_metadata);
if (!record->cobj_group_metadata) {
cfl_object_destroy(record->cobj_record);
cfl_object_destroy(record->cobj_metadata);
flb_free(record);
return FLB_MP_CHUNK_RECORD_ERROR;
}
}

if (record->event.group_attributes &&
(record->event.group_attributes->type == MSGPACK_OBJECT_MAP ||
record->event.group_attributes->type == MSGPACK_OBJECT_ARRAY)) {
record->cobj_group_attributes = flb_mp_object_to_cfl(record->event.group_attributes);
if (!record->cobj_group_attributes) {

Choose a reason for hiding this comment

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

P1 Badge Propagate group cobj modifications to encoded output

flb_mp_chunk_cobj_record_next now builds cobj_group_metadata and cobj_group_attributes so processors can mutate group context, but flb_mp_chunk_cobj_encode still serializes only cobj_metadata and cobj_record. If a processor updates the new group objects on a record, those changes are never copied back to the group header when the chunk is re-encoded, so modifications are silently lost and the feature described in the commit message (“read and modify … using the CFL object interface”) does not work. The encoder should either use these new pointers when emitting group start records or share a single cobj across all records in a group.

Useful? React with 👍 / 👎.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/flb_mp.c (2)

807-837: Bug: ARRAY branch uses map fields and counts (breaks array conversion).

In mp_object_to_cfl(), the MSGPACK_OBJECT_ARRAY case allocates and iterates using o->via.map.size instead of o->via.array.size. This can cause out-of-bounds/incorrect conversion and now affects group_attributes/metadata when arrays are present.

Apply:

-    case MSGPACK_OBJECT_ARRAY:
-        array = cfl_array_create(o->via.map.size);
+    case MSGPACK_OBJECT_ARRAY:
+        array = cfl_array_create(o->via.array.size);
         if (!array) {
             return -1;
         }
         ret = 0;
-
-        for (i = 0; i < o->via.map.size; i++) {
+        for (i = 0; i < o->via.array.size; i++) {
             ret = mp_object_to_cfl((void *) &var, &o->via.array.ptr[i]);
             if (ret == CFL_OBJECT_KVLIST) {
                 ret = cfl_array_append_kvlist(array, var);
             }
             else if (ret == CFL_OBJECT_VARIANT) {
                 ret = cfl_array_append(array, var);
             }
             else if (ret == CFL_OBJECT_ARRAY) {
                 ret = cfl_array_append_array(array, var);
             }
             else {
                 ret = -1;
                 break;
             }
         }

1036-1045: Early-return leak in flb_mp_cfl_to_msgpack on error.

If mp_cfl_to_msgpack() fails, mp_sbuf.data isn’t freed. Destroy the sbuffer before returning.

     ret = mp_cfl_to_msgpack(obj->variant, &mp_sbuf, &mp_pck);
     if (ret == -1) {
-        return -1;
+        msgpack_sbuffer_destroy(&mp_sbuf);
+        return -1;
     }
🧹 Nitpick comments (8)
tests/internal/log_event_decoder.c (1)

24-24: Optional: drop unused include.

flb_log_event_encoder.h isn’t used in this file; consider removing to reduce compile surface.

include/fluent-bit/flb_mp_chunk.h (1)

39-41: New group fields added — please document lifecycle.

cobj_group_metadata and cobj_group_attributes extend per-record context. Add a brief comment noting:

  • They mirror event.group_metadata/attributes when present.
  • Initialized to NULL in flb_mp_chunk_record_create and destroyed in both flb_mp_chunk_cobj_destroy and flb_mp_chunk_cobj_record_destroy.

Confirm no external users rely on flb_mp_chunk_record binary layout across releases.

tests/internal/mp_chunk_cobj.c (3)

56-66: Avoid hardcoded key lengths; use sizeof to prevent off-by-one mistakes.

Use sizeof("literal") - 1 for key lengths.

-    ret = flb_log_event_encoder_append_metadata_values(builder,
-                                                        FLB_LOG_EVENT_STRING_VALUE("group_id", 8),
+    ret = flb_log_event_encoder_append_metadata_values(builder,
+                                                        FLB_LOG_EVENT_STRING_VALUE("group_id", sizeof("group_id") - 1),
                                                         FLB_LOG_EVENT_INT64_VALUE(42));
@@
-    ret = flb_log_event_encoder_append_body_values(builder,
-                                                   FLB_LOG_EVENT_STRING_VALUE("resource_type", 13),
+    ret = flb_log_event_encoder_append_body_values(builder,
+                                                   FLB_LOG_EVENT_STRING_VALUE("resource_type", sizeof("resource_type") - 1),
                                                    FLB_LOG_EVENT_CSTRING_VALUE("demo"));

142-169: Test directly accesses cfl_variant internals; prefer public helpers when possible.

Accessing variant->type/data couples the test to internal layout. If available, use public getters (e.g., type and string accessors) to reduce brittleness. Current checks are fine for now.

If CFL lacks such getters, consider adding minimal helpers and switching tests to them.


132-140: Optional: also assert the trailing GROUP_END record.

You build a start, one normal record, and a group end. Verifying the GROUP_END strengthens coverage and ensures decoder iteration aligns with expectations.

Also applies to: 162-169

src/flb_mp.c (3)

849-853: Nit: typo in comment.

“strin” → “string”.

-            /* force key type to be strin, otherwise just abort */
+            /* force key type to be string, otherwise just abort */

1118-1172: Encoding path ignores group metadata/attributes — confirm intent.

flb_mp_chunk_cobj_encode() emits timestamp, metadata, body only. Group context (cobj_group_metadata/attributes) isn’t serialized, so processors’ changes to group objects won’t round-trip.

  • If intentional: add a short comment clarifying encode omits groups by design.
  • If not: we’ll need to emit a GROUP_START header via encoder (group_init + set group metadata/attributes) before the first record, and a GROUP_END at the end.

I can draft the patch if you want this preserved.


1286-1296: Replace recursion with iteration to avoid deep call chains on large skips.

Recursive calls to flb_mp_chunk_cobj_record_next when a record doesn’t match a condition can stack up. Convert to a loop that advances until a match/EOF to avoid potential stack growth on large streams.

Also applies to: 1312-1321, 1336-1345

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c7c4e1 and dee9e19.

📒 Files selected for processing (5)
  • include/fluent-bit/flb_mp_chunk.h (1 hunks)
  • src/flb_mp.c (4 hunks)
  • tests/internal/CMakeLists.txt (1 hunks)
  • tests/internal/log_event_decoder.c (1 hunks)
  • tests/internal/mp_chunk_cobj.c (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/flb_mp.c (2)
lib/cfl/src/cfl_object.c (1)
  • cfl_object_destroy (95-106)
include/fluent-bit/flb_mem.h (1)
  • flb_free (126-128)
tests/internal/mp_chunk_cobj.c (6)
src/flb_log_event_encoder.c (8)
  • flb_log_event_encoder_create (76-97)
  • flb_log_event_encoder_group_init (390-407)
  • flb_log_event_encoder_group_header_end (409-419)
  • flb_log_event_encoder_begin_record (246-254)
  • flb_log_event_encoder_set_timestamp (276-287)
  • flb_log_event_encoder_commit_record (256-274)
  • flb_log_event_encoder_group_end (421-443)
  • flb_log_event_encoder_destroy (99-116)
include/fluent-bit/flb_time.h (1)
  • flb_time_set (75-79)
src/flb_log_event_decoder.c (4)
  • flb_log_event_decoder_init (99-116)
  • flb_log_event_decoder_read_groups (85-97)
  • flb_log_event_decoder_get_record_type (408-428)
  • flb_log_event_decoder_destroy (147-179)
src/flb_mp.c (3)
  • flb_mp_chunk_cobj_create (1063-1083)
  • flb_mp_chunk_cobj_record_next (1214-1356)
  • flb_mp_chunk_cobj_destroy (1182-1212)
lib/cfl/src/cfl_kvlist.c (1)
  • cfl_kvlist_fetch (418-421)
lib/cfl/src/cfl_variant.c (1)
  • cfl_variant_size_get (292-295)
⏰ 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). (30)
  • GitHub Check: pr-windows-build / call-build-windows-package (Windows 32bit, x86, x86-windows-static, 3.31.6)
  • GitHub Check: pr-windows-build / call-build-windows-package (Windows 64bit (Arm64), amd64_arm64, -DCMAKE_SYSTEM_NAME=Windows -DCMA...
  • GitHub Check: pr-windows-build / call-build-windows-package (Windows 64bit, x64, x64-windows-static, 3.31.6)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, clang, clang++, ubuntu-24.04, clang-14)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_ARROW=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, gcc, g++)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, clang, clang++, ubuntu-22.04, clang-12)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_THREAD=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SIMD=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SANITIZE_MEMORY=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_COVERAGE=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_UNDEFINED=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, clang, clang++)
  • GitHub Check: PR - fuzzing test
  • GitHub Check: run-ubuntu-unit-tests (-DSANITIZE_ADDRESS=On, 3.31.6, gcc, g++)
  • GitHub Check: pr-compile-without-cxx (3.31.6)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, gcc, g++, ubuntu-24.04, clang-14)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, gcc, g++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=On, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, gcc, g++)
  • GitHub Check: pr-compile-system-libs (-DFLB_PREFER_SYSTEM_LIBS=On, 3.31.6, gcc, g++, ubuntu-22.04, clang-12)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_JEMALLOC=Off, 3.31.6, clang, clang++)
  • GitHub Check: run-ubuntu-unit-tests (-DFLB_SMALL=On, 3.31.6, gcc, g++)
  • GitHub Check: pr-compile-centos-7
🔇 Additional comments (5)
tests/internal/CMakeLists.txt (1)

27-27: Wiring new internal test looks good.

mp_chunk_cobj.c is correctly added to UNIT_TESTS_FILES and will be linked against fluent-bit-static/cfl-static.

src/flb_mp.c (4)

1257-1282: Group CFL conversion and cleanup look correct.

Good type checks, creation, and partial-failure cleanup for cobj_group_metadata/attributes.


1057-1059: Init of new group pointers to NULL is correct.

Prevents accidental free/double-free on error paths.


1200-1205: Destroy group objects in container destructor — good.

Properly frees cobj_group_metadata/attributes.


1383-1388: Destroy group objects in record destructor — good.

Consistent cleanup in per-record destroy path.

Comment on lines +26 to +28
#include <cfl/cfl_kvlist.h>

Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Include CFL umbrella header for variant APIs and struct layout.

The test uses struct cfl_variant fields and cfl_variant_size_get; include cfl/cfl.h to ensure prototypes and full type definitions are available across toolchains.

 #include <fluent-bit/flb_mp_chunk.h>
 
-#include <cfl/cfl_kvlist.h>
+#include <cfl/cfl.h>
+#include <cfl/cfl_kvlist.h>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#include <cfl/cfl_kvlist.h>
#include <cfl/cfl.h>
#include <cfl/cfl_kvlist.h>
🤖 Prompt for AI Agents
In tests/internal/mp_chunk_cobj.c around lines 26 to 27, the test uses struct
cfl_variant fields and calls cfl_variant_size_get but only includes
cfl/cfl_kvlist.h; add the umbrella header cfl/cfl.h to the includes so variant
APIs and full type definitions/prototypes are available across toolchains,
placing the new include alongside existing includes (before or after
cfl_kvlist.h) and remove no other includes.

Add cobj_group_metadata and cobj_group_attributes to flb_mp_chunk_record
to give processors access to shared group context alongside individual
record data. This enables processors to read and modify OpenTelemetry
resource attributes and scope metadata using the CFL object interface.

Signed-off-by: Eduardo Silva <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant