Skip to content

Conversation

@santigimeno
Copy link
Member

@santigimeno santigimeno commented May 6, 2025

This is a major dependency update that includes:

  • Update Protocol Buffers (protobuf) from previous version to 30.2
  • Update gRPC from previous version to 1.72.0
  • Update OpenTelemetry C++ to latest version
  • Add new build targets in protobuf.gyp:
    • protoc: Protocol Buffer compiler executable
    • protoc-gen-cpp: C++ code generator plugin for protoc

Infrastructure improvements:

  • Add helper functions in tools/dep_updaters/utils.sh:

    • setup_protoc_environment: Configure protoc build environment
    • regenerate_proto_otel: Regenerate OpenTelemetry proto files
    • regenerate_proto_agents: Regenerate NSolid agent proto files
  • Enhance updater scripts:

    • update-protobuf.sh: Improved handling of abseil-cpp dependency
    • update-grpc.sh: Streamlined update process
    • update-opentelemetry-cpp.sh: Automated proto regeneration
  • Regenerate all proto files in agents/grpc/src/proto/ with updated protoc:

    • Updated *.pb.cc, *.pb.h, and *.grpc.pb.h files
    • Ensures compatibility with new protobuf/gRPC versions

This update ensures NSolid remains compatible with the latest protocol
buffer and gRPC implementations, improving performance and security.

Summary by CodeRabbit

  • Refactor
    • Modernized all generated C++ gRPC/protobuf files to align with Protobuf C++ runtime version 6.30.2, improving performance, memory management, and thread safety.
    • Updated message classes with enhanced arena support, explicit field presence tracking, and improved serialization/parsing efficiency.
    • Refactored internal structures for better reflection, metadata handling, and platform compatibility.
  • Chores
    • Added platform-specific header includes to all gRPC service headers for improved compatibility across environments.
  • Bug Fixes
    • Ensured explicit extraction of string values from JSON iterators in event population functions to prevent implicit conversions and improve data correctness.

@santigimeno santigimeno self-assigned this May 6, 2025
@coderabbitai
Copy link

coderabbitai bot commented May 6, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update comprehensively regenerates all protobuf-generated C++ code and headers in the project to align with Protobuf C++ runtime version 6.30.2. The changes modernize code style, memory management, thread-safety annotations, arena allocation, internal APIs, and metadata/reflection support. Numerous files also add gRPC port definition includes for platform compatibility. Additionally, minor fixes were made in grpc_agent.cc to explicitly extract strings from JSON iterators.

Changes

File(s) Change Summary
agents/grpc/src/proto/asset.grpc.pb.h
agents/grpc/src/proto/blocked_loop.grpc.pb.h
agents/grpc/src/proto/command.grpc.pb.h
agents/grpc/src/proto/common.grpc.pb.h
agents/grpc/src/proto/exit.grpc.pb.h
agents/grpc/src/proto/info.grpc.pb.h
agents/grpc/src/proto/metrics.grpc.pb.h
agents/grpc/src/proto/nsolid_service.grpc.pb.h
agents/grpc/src/proto/packages.grpc.pb.h
Added grpcpp/ports_def.inc and grpcpp/ports_undef.inc includes at the start and end of each file to wrap content with platform/compiler-specific macro definitions for gRPC compatibility. No other logic or declaration changes.
agents/grpc/src/proto/asset.pb.cc Extensively refactored and regenerated for protobuf 6.30.2: replaced legacy namespace macros with explicit google::protobuf usage, introduced Impl_ struct for internal storage, modernized constructors/destructors with arena support, updated field presence tracking, optimized serialization/merging/clearing, and added new internal reflection and parsing table structures.
agents/grpc/src/proto/asset.pb.h Modernized and regenerated header for protobuf 6.30.2: updated include guards, version checks, explicit google::protobuf namespaces, refactored Asset class with arena-aware constructors, destructors, and field accessors, added thread-sanitizer annotations, explicit has-bits tracking, new internal class data and reflection methods, and improved memory management for submessages and strings.
agents/grpc/src/proto/command.pb.cc Regenerated for protobuf 6.30.2: replaced macros with explicit namespaces, added constexpr/internal constructors, arena-aware copy/merge/clear, updated oneof management, new parsing/serialization tables, upgraded internal APIs, removed deprecated methods, and improved reflection and class data handling for CommandArgs, CommandRequest, and CommandResponse.
agents/grpc/src/proto/command.pb.h Fully regenerated header for protobuf 6.30.2: updated include guards, version checks, replaced macros with explicit namespaces, refactored message classes with arena-aware constructors, thread-sanitizer annotations, new internal APIs for field access, presence tracking, reflection, unsafe arena pointer management, and improved metadata/class data support.
agents/grpc/src/proto/common.pb.cc Regenerated and modernized for protobuf 6.30.2: replaced macros with explicit namespaces, introduced Impl_ structs, arena-aware constructors/destructors, updated field presence and memory management, new parsing and serialization tables, improved thread-safety, and added internal reflection and metadata handling for Time, ErrorInfo, and CommonResponse.
agents/grpc/src/proto/common.pb.h Updated header for protobuf 6.30.2: new include guards/version checks, explicit namespaces, refactored message classes with arena-aware constructors, explicit has-bits, thread-sanitizer annotations, improved field accessors, updated memory management for submessages and strings, and modernized internal reflection/metadata support.
agents/grpc/src/proto/exit.pb.cc Regenerated for protobuf 6.30.2: replaced macros with explicit namespaces, added Impl_ structs, arena-aware constructors/destructors, updated field presence tracking, modernized parsing/serialization, improved memory management, new class data and reflection methods, and removed deprecated/internal methods for Error, ExitBody, and ExitEvent.
agents/grpc/src/proto/exit.pb.h Modernized header for protobuf 6.30.2: new include guards/version checks, explicit namespaces, refactored message classes with arena-aware constructors, explicit has-bits, thread-sanitizer annotations, improved field accessors, updated memory management for submessages and strings, and new internal reflection/metadata support for Error, ExitBody, and ExitEvent.
agents/grpc/src/proto/metrics.pb.cc Regenerated for protobuf 6.30.2: explicit namespace usage, Impl_ structs, arena-aware constructors/destructors, new parsing/serialization tables, improved field presence tracking, optimized serialization/merging/clearing, and modernized internal reflection and metadata handling for MetricsBody and MetricsEvent.
agents/grpc/src/proto/metrics.pb.h Updated header for protobuf 6.30.2: new include guards/version checks, explicit namespaces, refactored message classes with arena-aware constructors, explicit has-bits, thread-sanitizer annotations, improved field accessors, updated memory management for submessages and repeated fields, and new internal class data/reflection support for MetricsBody and MetricsEvent.
agents/grpc/src/proto/nsolid_service.pb.cc Regenerated for protobuf 6.30.2: updated includes, explicit namespaces, added Impl_ struct, arena-aware constructors/destructors, new parsing/serialization tables, improved field presence tracking, optimized serialization/merging/clearing, and modernized internal reflection and metadata support for EventResponse.
agents/grpc/src/proto/nsolid_service.pb.h Modernized header for protobuf 6.30.2: new include guards/version checks, explicit namespaces, refactored EventResponse class with arena-aware constructors, explicit has-bits, thread-sanitizer annotations, improved field accessors, updated memory management for strings, and new internal class data/reflection support.
agents/grpc/src/proto/packages.pb.cc Regenerated for protobuf 6.30.2: explicit namespace usage, Impl_ structs, arena-aware constructors/destructors, updated field presence tracking, new parsing/serialization tables, improved memory management for submessages and repeated fields, and modernized internal reflection and metadata handling for Package, PackagesBody, and PackagesEvent.
agents/grpc/src/grpc_agent.cc Fixed JSON string extraction by replacing direct iterator dereferences with explicit get<std::string>() calls when assigning protobuf string fields in PopulateBlockedLoopEvent and PopulateReconfigureEvent. No changes to declarations or logic beyond this explicit extraction.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant gRPC_Server
    participant ProtobufMessage

    Client->>gRPC_Server: Send request with ProtobufMessage
    gRPC_Server->>ProtobufMessage: Deserialize message (arena-aware)
    ProtobufMessage-->>gRPC_Server: Message object with presence bits, reflection, etc.
    gRPC_Server->>ProtobufMessage: Serialize response (arena-aware)
    ProtobufMessage-->>gRPC_Server: Serialized bytes
    gRPC_Server-->>Client: Send response
Loading

Poem

A bunny hopped through code anew,
With protobuf fields and bits to chew.
Arena-safe and thread-aware,
Reflection magic everywhere!
Ports wrapped snug for every land,
Modern C++ at bunny’s command.
🐇✨ Cheers to changes, crisp and bright—
The code now runs just right!

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@santigimeno santigimeno force-pushed the santi/protobuf_grpc_otel_cpp_updaters branch from 3685f5c to 1d8bbe4 Compare May 6, 2025 18:51
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: 5

♻️ Duplicate comments (3)
agents/grpc/src/proto/metrics.pb.cc (1)

2-4: Generated code committed – verify consistency with build process

Same banner/policy mismatch as in nsolid_service.pb.cc. Before this lands on main, please clarify whether the project now intends to vendor generated protobuf C++ sources. If not, drop the commit or move code-gen to the CI pipeline.

Duplicated reasoning as above.

agents/grpc/src/proto/packages.pb.cc (1)

2-4: Generated .pb.cc is checked in despite “NO CHECKED-IN PROTOBUF GENCODE”

Confirm that committing these files is deliberate. If accidental, regenerate during the build instead and keep the repository lean. Otherwise, strip the banner to avoid confusing future contributors.

agents/grpc/src/proto/metrics.pb.h (1)

2-4: Large generated header checked in – same policy concern

Same as for command.pb.cc: the guard comment forbids committing generated code. Unless there is a clear, documented reason, treat these files as build artefacts.

If they must stay, add them to .gitattributes with:

*.pb.h linguist-generated
*.pb.cc linguist-generated

to silence code-review tooling.

🧹 Nitpick comments (8)
agents/grpc/src/proto/common.pb.cc (2)

2-5: *Consider omitting generated .pb.cc from VCS.

The header comment still reads “NO CHECKED-IN PROTOBUF GENCODE”, yet the file is committed.
Keeping several megabytes of generated artefacts in the repo can:
• Inflate repository size.
• Create noisy diffs every time protoc is re-run.
• Create merge conflicts when multiple branches regenerate code with different plugin versions.

If distribution of generated code is strictly required (e.g., to avoid requiring protoc in consumer environments), please add a short note to CONTRIBUTING.md explaining the rationale and the exact protoc/grpc/protobuf versions so future contributors regenerate with the same tool-chain.


175-184: Descriptor blob size jumped – confirm size-related warnings.

The literal descriptor array grew to ~250 bytes. Some tool-chains warn when string literals exceed certain limits in a single translation unit (rare on modern compilers but happens in embedded builds).
If your targets include very small devices, consider moving large descriptor blobs to a dedicated .cc compiled with relaxed warnings, or enable --descriptor_set_out+reflection-less builds.

agents/grpc/src/proto/nsolid_service.pb.cc (1)

2-4: Commit contradicts in-file banner – confirm policy for generated code

The header still states // NO CHECKED-IN PROTOBUF GENCODE, yet the file is being committed. If your repository’s policy is to rebuild .pb.cc/.pb.h during the build, checking-in generated artefacts can cause merge noise, stale code, and version skew with the tool-chain (protobuf 6.30.2 vs future regenerations).

Consider either

  1. removing the banner and intentionally version-controlling generated code, or
  2. adding these files to .gitignore/CMakeLists so they are produced at build-time only.

Feel free to ping me if you want a sample CMake rule that regenerates the sources.

agents/grpc/src/proto/common.pb.h (1)

6-7: Include-guard name collides with previous generator output

#define common_2eproto_2epb_2eh is identical to the guard produced by the older generator.
If any previously-generated header with the same name but different content still exists in the include-path, the first one wins silently, leading to ODR/ABI mismatches.

Consider adding a per-generator timestamp or out-of-tree include path (e.g., generated/v6_30_2/...) to avoid collisions.

agents/grpc/src/proto/metrics.pb.h (1)

14-19: Hard version pinning may break downstream package managers

Pinning to an exact micro-version (6030002) means any patch release of protobuf will break your build. If reproducibility is the goal, lock the compiler via CI tooling rather than pre-processor guards, or relax the check to the major/minor pair:

-#if PROTOBUF_VERSION != 6030002
+#if PROTOBUF_VERSION / 100 != 60300   /* accept 6.30.x */
agents/grpc/src/proto/asset.pb.h (1)

2-4: Generated code contradicts the “NO CHECKED-IN PROTOBUF GENCODE” banner

The header explicitly says no protobuf gencode should be checked-in, yet the file is committed. Keeping generated artifacts in VCS bloats the repo, clutters reviews, and often falls out of sync with the .proto sources.

Consider adding the agents/grpc/src/proto/*.pb.{h,cc} patterns to .gitignore and generating them in the build pipeline instead.

agents/grpc/src/proto/exit.pb.h (1)

2-4: Same concern: generated gencode committed despite banner

As with asset.pb.h, the header says “NO CHECKED-IN PROTOBUF GENCODE” yet lives in the repo. Please confirm that committing generated sources is intentional and documented, or move generation to the build step.

agents/grpc/src/proto/asset.pb.cc (1)

2-4: Large amount of regenerated code checked in

The .cc file is ~4 k LOC of generated output. Storing this in VCS:

  • Inflates repository size & pull-requests
  • Creates noisy diffs like this one
  • Requires developers to remember to regenerate after every .proto edit

Unless your deployment flow requires shipping generated C++ sources (e.g., non-Bazel consumers), consider removing them from the repo and generating during the build (CMake protobuf_generate, Bazel rules, etc.).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9265d2f and 1d8bbe4.

📒 Files selected for processing (22)
  • agents/grpc/src/proto/asset.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/asset.pb.cc (2 hunks)
  • agents/grpc/src/proto/asset.pb.h (2 hunks)
  • agents/grpc/src/proto/blocked_loop.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/command.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/command.pb.cc (5 hunks)
  • agents/grpc/src/proto/command.pb.h (8 hunks)
  • agents/grpc/src/proto/common.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/common.pb.cc (4 hunks)
  • agents/grpc/src/proto/common.pb.h (2 hunks)
  • agents/grpc/src/proto/exit.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/exit.pb.cc (4 hunks)
  • agents/grpc/src/proto/exit.pb.h (3 hunks)
  • agents/grpc/src/proto/info.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/metrics.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/metrics.pb.cc (3 hunks)
  • agents/grpc/src/proto/metrics.pb.h (1 hunks)
  • agents/grpc/src/proto/nsolid_service.grpc.pb.h (2 hunks)
  • agents/grpc/src/proto/nsolid_service.pb.cc (2 hunks)
  • agents/grpc/src/proto/nsolid_service.pb.h (2 hunks)
  • agents/grpc/src/proto/packages.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/packages.pb.cc (4 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
agents/grpc/src/proto/nsolid_service.pb.cc (2)
agents/grpc/src/proto/asset.pb.cc (20)
  • Impl_ (29-41)
  • Impl_ (29-30)
  • Impl_ (165-168)
  • Impl_ (203-205)
  • Message (160-164)
  • Message (179-202)
  • _instance (53-53)
  • _impl_ (50-51)
  • MergeImpl (550-614)
  • MergeImpl (550-550)
  • ByteSizeLong (480-643)
  • ByteSizeLong (480-480)
  • ByteSizeLong (483-548)
  • ByteSizeLong (483-483)
  • _InternalSerialize (391-477)
  • _InternalSerialize (391-393)
  • void (355-383)
  • Clear (355-355)
  • GetMetadata (639-641)
  • GetMetadata (639-639)
agents/grpc/src/proto/asset.pb.h (34)
  • Impl_ (338-338)
  • Impl_ (339-341)
  • Impl_ (342-345)
  • _impl_ (185-185)
  • _internal_metadata_ (108-111)
  • PROTOBUF_NONNULL (82-85)
  • PROTOBUF_NONNULL (82-82)
  • PROTOBUF_NONNULL (132-139)
  • PROTOBUF_NONNULL (132-132)
  • PROTOBUF_NONNULL (140-144)
  • PROTOBUF_NONNULL (140-140)
  • PROTOBUF_NONNULL (190-190)
  • PROTOBUF_NULLABLE (188-188)
  • PROTOBUF_NULLABLE (234-234)
  • PROTOBUF_NULLABLE (248-248)
  • PROTOBUF_NULLABLE (249-249)
  • PROTOBUF_NULLABLE (263-263)
  • PROTOBUF_NULLABLE (264-264)
  • from (94-97)
  • from (94-94)
  • from (98-106)
  • from (98-98)
  • from (152-152)
  • from (154-154)
  • from (154-154)
  • ByteSizeLong (173-173)
  • _InternalSerialize (168-170)
  • _InternalSerialize (174-178)
  • _InternalSerialize (181-183)
  • GetClassData (204-204)
  • void (602-607)
  • to_msg (157-158)
  • swap (131-131)
  • swap (131-131)
agents/grpc/src/proto/asset.pb.h (1)
agents/grpc/src/proto/asset.pb.cc (17)
  • Asset (44-44)
  • Asset (218-221)
  • Asset (232-236)
  • Asset (232-234)
  • Asset (268-272)
  • Asset (268-268)
  • Asset (386-388)
  • SharedDtor (222-230)
  • SharedDtor (222-222)
  • CopyFrom (616-621)
  • CopyFrom (616-616)
  • MergeImpl (550-614)
  • MergeImpl (550-550)
  • void (355-383)
  • _InternalSerialize (391-477)
  • _InternalSerialize (391-393)
  • _impl_ (50-51)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: test-tarball-linux
  • GitHub Check: test-linux (ubuntu-24.04-arm)
  • GitHub Check: test-linux (ubuntu-24.04)
  • GitHub Check: test-macOS
  • GitHub Check: coverage-linux
  • GitHub Check: coverage-linux-without-intl
  • GitHub Check: coverage-windows
🔇 Additional comments (16)
agents/grpc/src/proto/command.grpc.pb.h (1)

33-33: Wrap generated gRPC code with port macros
The inclusion of <grpcpp/ports_def.inc> before the namespace (line 33) and <grpcpp/ports_undef.inc> after the namespace (line 40) correctly scopes platform/compiler-specific macros around the generated code, aligning with gRPC best practices and matching the updates in other service headers.

Also applies to: 40-40

agents/grpc/src/proto/blocked_loop.grpc.pb.h (1)

33-33: Apply consistent port macro wrapping
Adding <grpcpp/ports_def.inc> at line 33 and <grpcpp/ports_undef.inc> at line 40 properly encapsulates the generated content to manage macro definitions, ensuring cross-platform consistency and mirroring changes in other gRPC headers.

Also applies to: 40-40

agents/grpc/src/proto/info.grpc.pb.h (1)

27-27: Encapsulate includes with gRPC port macros
The newly added <grpcpp/ports_def.inc> (line 27) and <grpcpp/ports_undef.inc> (line 34) correctly bracket the generated code, standardizing compiler/OS macros across all gRPC headers.

Also applies to: 34-34

agents/grpc/src/proto/metrics.grpc.pb.h (1)

27-27: Standardize macro definitions around generated code
Wrapping the gRPC-generated content with <grpcpp/ports_def.inc> at line 27 and <grpcpp/ports_undef.inc> at line 34 ensures consistent macro handling and aligns this file with the rest of the gRPC headers.

Also applies to: 34-34

agents/grpc/src/proto/nsolid_service.grpc.pb.h (1)

27-27: Bracket gRPC service definitions with port macros
Inserting <grpcpp/ports_def.inc> at line 27 and <grpcpp/ports_undef.inc> at line 1886 correctly wraps the extensive generated service declarations, providing platform/compiler macro isolation consistent with other updated headers.

Also applies to: 1886-1886

agents/grpc/src/proto/common.grpc.pb.h (1)

27-28: Ports wrappers are correctly placed – no action needed.

grpcpp/ports_def.inc and grpcpp/ports_undef.inc must wrap all public gRPC headers after v1.71 to guarantee the right platform‐specific symbol visibility.
Placement (immediately after the <grpcpp/support/...> include set and just before the closing #endif) is correct and matches upstream templates.
Nothing to change here.

Also applies to: 34-34

agents/grpc/src/proto/packages.grpc.pb.h (1)

33-34: Consistent port-macro wrapping – looks good.

Same observation as in common.grpc.pb.h: wrappers are in the canonical spots, ensuring the file compiles on all supported platforms.

Also applies to: 40-40

agents/grpc/src/proto/exit.grpc.pb.h (1)

27-28: No issues spotted – inclusion pattern is correct.

The newly added port headers are positioned exactly as upstream gRPC expects.

Also applies to: 34-34

agents/grpc/src/proto/asset.grpc.pb.h (1)

27-28: Ports headers added correctly.

Nothing else was touched; the change is minimal and safe.

Also applies to: 34-34

agents/grpc/src/proto/common.pb.cc (1)

22-27: Compile-time dependency bump – verify tool-chain flags.

The regenerated code now relies on C++17 features (std::is_constant_evaluated, inline constexpr ctors, etc.) that sneak in via <type_traits> and protobuf’s 6.x internals.
Please make sure:

  1. The project’s build system passes at least -std=c++17 (or the MSVC equivalent).
  2. Older compilers (e.g., GCC 7 or Clang 5) are no longer in your supported matrix.

Otherwise this code will fail to compile in downstream environments.

agents/grpc/src/proto/common.pb.h (1)

2-7:

Details

❓ Verification inconclusive

Mismatch risk between compiled runtime and generated headers

The header enforces PROTOBUF_VERSION == 6030002. Ensure that:

  1. The build images (Dockerfile, CI, local dev) install protobuf 6.30.2 exactly.
  2. No transitive dependency (e.g., gRPC v1.72 vendored copy) pulls a different minor version of libprotobuf at link-time.

Otherwise you will hit hard-to-diagnose ODR violations or compilation errors.


🏁 Script executed:

#!/bin/bash
# Quick sanity-check: locate libprotobuf versions on the build host
ldconfig -p | grep libprotobuf || true

Length of output: 138


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== protoc version ==="
if command -v protoc >/dev/null 2>&1; then
  protoc --version
else
  echo "protoc: not found"
fi

echo
echo "=== pkg-config protobuf version ==="
if command -v pkg-config >/dev/null 2>&1; then
  pkg-config --modversion protobuf || echo "pkg-config protobuf: no metadata"
else
  echo "pkg-config: not found"
fi

echo
echo "=== Locate libprotobuf in filesystem ==="
find /usr /lib -type f -name 'libprotobuf.so*' 2>/dev/null || echo "no libprotobuf found"

Length of output: 453


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "=== Searching for Dockerfiles ==="
fd -HI -t f 'Dockerfile*' || echo "No Dockerfiles found"

echo
echo "=== Inspecting Dockerfiles for protobuf install commands ==="
rg -nE 'apt(-get)? install.*protobuf|yum install.*protobuf|brew install.*protobuf|protobuf-compiler' --glob 'Dockerfile*' || echo "No protobuf install lines in Dockerfiles"

echo
echo "=== Scanning GitHub Actions workflows for protobuf references ==="
rg -n 'protobuf' --glob '.github/workflows/*.yml' || echo "No protobuf references in workflows"

Length of output: 1978


Ensure Protobuf 6.30.2 matches generated headers

The generated header in agents/grpc/src/proto/common.pb.h (enforced by
#if PROTOBUF_VERSION != 6030002) requires your build and link-time runtime to use exactly protobuf 6.30.2. No explicit protobuf installs or version pins were found in your Dockerfiles or GitHub workflows, so please:

  • Pin protobuf to 6.30.2 in all build images and dev containers
    • e.g. deps/opentelemetry-cpp/.devcontainer/Dockerfile.dev
    • any deps/grpc/…/Dockerfile used by your CI or local builds
  • Add version-pinned installs in your CI pipelines (.github/workflows/*.yml)
  • Verify local dev scripts or documentation install protobuf-compiler==6.30.2
  • Audit transitive dependencies (e.g. vendored gRPC) to ensure they don’t pull a different libprotobuf minor version at link time

Without these pins you risk ODR violations or runtime/compile errors due to mismatched protobuf versions.

agents/grpc/src/proto/exit.pb.cc (1)

21-23: Include ordering: keep port headers last

port_def.inc must be the very last protobuf include, but new code occasionally appends extra includes later during manual edits. Double-check that no further #include lines are added after line 23 by future manual modifications.

agents/grpc/src/proto/nsolid_service.pb.h (1)

14-19: Runtime version guard – verify availability of protobuf 6.30.2

As with command.pb.h, ensure CI images and release tooling provide the exact protobuf runtime that matches this header.

agents/grpc/src/proto/asset.pb.h (1)

14-19: Build may fail if the runtime uses a different protobuf patch-level

The hard check

#if PROTOBUF_VERSION != 6030002
#error …
#endif

will break compilation when the system protobuf runtime is even one patch ahead/behind 6.30.2. If your CI or distro tool-chain upgrades protobuf, the whole build will be red-flagged.

If reproducible builds are required, pinning a vendored protobuf or using CMake’s FetchContent to pull the exact version is safer than relying on the system install.

agents/grpc/src/proto/exit.pb.h (1)

14-19: Strict version guard risks accidental build breakage

The #if PROTOBUF_VERSION != 6030002 check enforces an exact patch-level. Evaluate whether you want == 6030*** (major.minor) instead, or pin the runtime in your tool-chain to avoid surprise build failures.

agents/grpc/src/proto/asset.pb.cc (1)

24-27: Namespace aliases _pb, _pbi, _fl leak into the global TU

These aliases are introduced at file scope:

namespace _pb = ::google::protobuf;
namespace _pbi = ::google::protobuf::internal;
namespace _fl  = ::google::protobuf::internal::field_layout;

While harmless in generated code, they could clash if another TU #includes this .cc indirectly or defines the same aliases. Normally a generated .cc is compiled as a standalone translation unit, so it’s fine; just ensure the build never #includes a generated .cc.

Comment on lines +2 to 3
// NO CHECKED-IN PROTOBUF GENCODE
// source: command.proto
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Generated sources are being committed despite “NO CHECKED-IN PROTOBUF GENCODE” guard

Lines 2–3 explicitly state that protobuf-generated artefacts should not be checked into VCS, yet the file is present in the PR. Keeping large generated files in the repo:

  • contradicts the documented policy,
  • dramatically inflates repository size / diff noise,
  • risks merge conflicts whenever someone regenerates with a slightly different protoc/clang-format version.

If these files must be present for your build system, consider:

-// NO CHECKED-IN PROTOBUF GENCODE
+// NOTE: Generated code intentionally checked in – see docs/GENERATED_CODE.md

…and add a short rationale in the proposed doc. Otherwise, delete the whole agents/grpc/src/proto/*.pb.{h,cc} directory and build them during CI.


🏁 Script executed:

#!/bin/bash
# List all committed files still containing the guard comment
rg --line-number --fixed-strings "NO CHECKED-IN PROTOBUF GENCODE" agents/grpc/src/proto

Length of output: 1984


Generated protobuf artifacts still checked in despite guard

All files under agents/grpc/src/proto/*.pb.{h,cc} still contain the

// NO CHECKED-IN PROTOBUF GENCODE

guard comment, which contradicts the documented policy. You must choose one of two paths:

  1. If these protobuf-generated sources are required in the repo for your build system, update their header comment and provide a rationale:

    -// NO CHECKED-IN PROTOBUF GENCODE
    +// NOTE: Generated code intentionally checked in – see docs/GENERATED_CODE.md

    • Create docs/GENERATED_CODE.md and explain why checked-in code is necessary (tooling constraints, CI performance, etc.).

  2. Otherwise, remove the entire directory of generated files and adjust CI/configuration to run protoc at build time:
    • Delete agents/grpc/src/proto/*.pb.h and *.pb.cc.
    • Add a CI step (e.g., in your Makefile or pipeline) to regenerate these files before compilation.

Please apply one of these solutions to keep your codebase consistent and avoid merge conflicts.

📝 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
// NO CHECKED-IN PROTOBUF GENCODE
// source: command.proto
// NOTE: Generated code intentionally checked in – see docs/GENERATED_CODE.md
// source: command.proto

Comment on lines +2 to 3
// NO CHECKED-IN PROTOBUF GENCODE
// source: command.proto
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Generated code is being committed despite the “NO CHECKED-IN PROTOBUF GENCODE” banner

Both lines 2-3 explicitly state that protobuf output should not be checked into VCS. Keeping ~25 000 lines of generated C++ will add maintenance overhead, inflate the repo, and create merge noise on every regen.
Unless the project policy has changed, please drop the generated files from the PR and let the build system regenerate them (e.g. via protoc in the CI or make proto).
If the policy did change, please update the contributor guide and remove the banner from the template used by protoc.

Comment on lines +2 to 3
// NO CHECKED-IN PROTOBUF GENCODE
// source: nsolid_service.proto
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Generated header should not be version-controlled

Same rationale as the previous two files – please remove or justify inclusion of generated sources.

@santigimeno santigimeno force-pushed the santi/protobuf_grpc_otel_cpp_updaters branch from 1d8bbe4 to 1ff0b06 Compare May 6, 2025 19:01
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: 2

♻️ Duplicate comments (5)
agents/grpc/src/proto/common.pb.cc (1)

2-2: Generated protobuf artifacts still checked in despite guard comment.

This file contains the guard comment // NO CHECKED-IN PROTOBUF GENCODE but is still being checked into the repository as part of the dependency update to protobuf 30.2.

agents/grpc/src/proto/packages.pb.cc (1)

2-2: Generated protobuf artifacts still checked in despite guard comment.

This file contains the guard comment // NO CHECKED-IN PROTOBUF GENCODE but is still being checked into the repository as part of the dependency update to protobuf 30.2.

agents/grpc/src/proto/command.pb.cc (1)

2-2: Generated protobuf artifacts still checked in despite guard comment.

This file contains the guard comment // NO CHECKED-IN PROTOBUF GENCODE but is still being checked into the repository as part of the dependency update to protobuf 30.2.

agents/grpc/src/proto/exit.pb.cc (1)

2-2: Same banner → same concern: remove checked-in generated code

The "NO CHECKED-IN PROTOBUF GENCODE" notice appears here as well. This file contains automatically generated code that according to the notice should not be checked into the repository.

agents/grpc/src/proto/command.pb.h (1)

2-2: Same banner issue applies to all generated protobuf files

The "NO CHECKED-IN PROTOBUF GENCODE" notice appears in this file too, contradicting the fact that it's being committed to the repository.

🧹 Nitpick comments (2)
agents/grpc/src/proto/command.pb.cc (1)

1-4: Project-wide recommendation for protobuf-generated code strategy

All protobuf-generated files (.pb.cc and .pb.h) in this PR contain a warning comment about not checking them in, yet they're being maintained in the repository. This creates a contradiction in the project's practices.

You should either:

  1. Remove the "NO CHECKED-IN PROTOBUF GENCODE" comments and document why generated files are kept in the repository, or
  2. Remove these files from version control and add appropriate build steps to generate them during the build process

This approach should be applied consistently across all protobuf-generated files in the project.

agents/grpc/src/proto/common.pb.h (1)

14-19: Version coupling could impact CI/CD and developer environments

The hard dependency on protobuf version 6.30.2 can cause build failures if the exact version isn't available. This tight coupling affects build reproducibility across different environments.

Consider documenting this dependency clearly in the project's README or build instructions to ensure all developers and CI/CD systems use the correct version. Additionally, you might want to provide a containerized build environment with the exact dependencies pre-installed.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d8bbe4 and 1ff0b06.

📒 Files selected for processing (22)
  • agents/grpc/src/proto/asset.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/asset.pb.cc (2 hunks)
  • agents/grpc/src/proto/asset.pb.h (2 hunks)
  • agents/grpc/src/proto/blocked_loop.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/command.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/command.pb.cc (5 hunks)
  • agents/grpc/src/proto/command.pb.h (8 hunks)
  • agents/grpc/src/proto/common.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/common.pb.cc (4 hunks)
  • agents/grpc/src/proto/common.pb.h (2 hunks)
  • agents/grpc/src/proto/exit.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/exit.pb.cc (4 hunks)
  • agents/grpc/src/proto/exit.pb.h (3 hunks)
  • agents/grpc/src/proto/info.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/metrics.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/metrics.pb.cc (3 hunks)
  • agents/grpc/src/proto/metrics.pb.h (1 hunks)
  • agents/grpc/src/proto/nsolid_service.grpc.pb.h (2 hunks)
  • agents/grpc/src/proto/nsolid_service.pb.cc (2 hunks)
  • agents/grpc/src/proto/nsolid_service.pb.h (2 hunks)
  • agents/grpc/src/proto/packages.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/packages.pb.cc (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • agents/grpc/src/proto/exit.grpc.pb.h
🚧 Files skipped from review as they are similar to previous changes (9)
  • agents/grpc/src/proto/info.grpc.pb.h
  • agents/grpc/src/proto/metrics.grpc.pb.h
  • agents/grpc/src/proto/packages.grpc.pb.h
  • agents/grpc/src/proto/blocked_loop.grpc.pb.h
  • agents/grpc/src/proto/common.grpc.pb.h
  • agents/grpc/src/proto/command.grpc.pb.h
  • agents/grpc/src/proto/nsolid_service.grpc.pb.h
  • agents/grpc/src/proto/asset.grpc.pb.h
  • agents/grpc/src/proto/nsolid_service.pb.h
🧰 Additional context used
🧬 Code Graph Analysis (1)
agents/grpc/src/proto/asset.pb.cc (2)
agents/grpc/src/proto/asset.pb.h (50)
  • Impl_ (338-338)
  • Impl_ (339-341)
  • Impl_ (342-345)
  • Asset (78-78)
  • Asset (78-78)
  • Asset (79-79)
  • Asset (89-89)
  • Asset (91-91)
  • Asset (91-91)
  • Asset (92-93)
  • Asset (92-92)
  • Asset (197-197)
  • Asset (198-198)
  • Asset (199-203)
  • Asset (409-427)
  • Asset (409-409)
  • Asset (428-436)
  • Asset (428-428)
  • Asset (437-444)
  • _impl_ (185-185)
  • PROTOBUF_NONNULL (82-85)
  • PROTOBUF_NONNULL (82-82)
  • PROTOBUF_NONNULL (132-139)
  • PROTOBUF_NONNULL (132-132)
  • PROTOBUF_NONNULL (140-144)
  • PROTOBUF_NONNULL (140-140)
  • PROTOBUF_NONNULL (190-190)
  • PROTOBUF_NULLABLE (188-188)
  • PROTOBUF_NULLABLE (234-234)
  • PROTOBUF_NULLABLE (248-248)
  • PROTOBUF_NULLABLE (249-249)
  • PROTOBUF_NULLABLE (263-263)
  • PROTOBUF_NULLABLE (264-264)
  • from (94-97)
  • from (94-94)
  • from (98-106)
  • from (98-98)
  • from (152-152)
  • from (154-154)
  • from (154-154)
  • self (189-189)
  • PlacementNew_ (205-207)
  • ByteSizeLong (173-173)
  • _InternalSerialize (168-170)
  • _InternalSerialize (174-178)
  • _InternalSerialize (181-183)
  • GetClassData (204-204)
  • void (602-607)
  • swap (131-131)
  • swap (131-131)
agents/grpc/src/proto/nsolid_service.pb.cc (32)
  • Impl_ (29-34)
  • Impl_ (29-30)
  • Impl_ (164-167)
  • Impl_ (188-190)
  • Message (159-163)
  • Message (178-187)
  • _impl_ (43-44)
  • SharedCtor (194-196)
  • SharedCtor (194-194)
  • SharedDtor (201-207)
  • SharedDtor (201-201)
  • PlacementNew_ (209-213)
  • PlacementNew_ (209-211)
  • InternalNewImpl_ (214-217)
  • InternalNewImpl_ (214-214)
  • InternalGenerateClassData_ (218-239)
  • InternalGenerateClassData_ (218-218)
  • MergeImpl (364-384)
  • MergeImpl (364-364)
  • ByteSizeLong (337-407)
  • ByteSizeLong (337-337)
  • ByteSizeLong (340-362)
  • ByteSizeLong (340-340)
  • _InternalSerialize (303-305)
  • _InternalSerialize (308-334)
  • _InternalSerialize (308-310)
  • GetClassData (245-249)
  • GetClassData (245-245)
  • void (287-300)
  • Clear (287-287)
  • GetMetadata (403-405)
  • GetMetadata (403-403)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: test-tarball-linux
  • GitHub Check: test-macOS
  • GitHub Check: coverage-linux-without-intl
  • GitHub Check: coverage-linux
  • GitHub Check: test-linux (ubuntu-24.04-arm)
  • GitHub Check: test-linux (ubuntu-24.04)
  • GitHub Check: coverage-windows
🔇 Additional comments (71)
agents/grpc/src/proto/command.pb.h (1)

14-19:

Details

❓ Verification inconclusive

Ensure consistent protobuf runtime availability for all build environments

The strict version requirement (protobuf 6.30.2) could lead to build failures in different environments where this exact version isn't available.

Run this script to check if you have the correct version in CI/CD environments:


🏁 Script executed:

#!/bin/bash
# Check if the exact required version is available

# Print the protobuf version that will be used
echo "Checking for Protobuf version in include paths..."
for path in $(cpp -v 2>&1 | grep "^ /" | grep -v "framework"); do
  if [ -f "$path/google/protobuf/runtime_version.h" ]; then
    echo "Found in $path:"
    grep "define PROTOBUF_VERSION" "$path/google/protobuf/runtime_version.h" || echo "  No version defined"
  fi
done

# Check if there are multiple versions (potential ODR violation)
count=$(find /usr -name "runtime_version.h" -type f 2>/dev/null | wc -l)
if [ "$count" -gt 1 ]; then
  echo "WARNING: Multiple protobuf runtime_version.h files found, possible ODR violation risk"
fi

Length of output: 235


Confirm Protobuf header availability and version alignment

Our environment check didn’t locate any runtime_version.h in the system include paths (and found no multiple versions), which means the build may either fail or rely on vendored headers. Please verify that:

  • All CI/dev environments provide Protobuf 6.30.2 in their include paths (or vendor the exact headers),
  • Or consider broadening the check to accept any 6.30.x patch version to reduce build fragility.

• agents/grpc/src/proto/command.pb.h (lines 14–19)

agents/grpc/src/proto/asset.pb.cc (12)

1-5: Successfully updated to Protobuf C++ 6.30.2

The file has been properly regenerated with the new Protobuf version, as indicated by the version comment.


8-22: Updated includes and modern Protobuf headers

The includes have been properly updated to work with Protobuf 6.30.2, adding important headers like generated_message_tctable_impl.h for the table-driven parsing infrastructure.


24-27: Modernized namespace usage

Properly switched from Protobuf namespace macros to explicit namespace references using aliases, improving code readability and maintainability.


29-149: Upgraded to modern Protobuf implementation architecture

Successfully implemented the new Protobuf architecture with:

  • Arena-aware constructors and internal Impl_ struct
  • Constant initialization support
  • Modern layout with has_bits for field presence tracking
  • Thread sanitizer annotations

These changes improve memory management, threading safety, and performance.


232-272: Updated object lifecycle management

Modern Protobuf method implementations for:

  • PlacementNew_
  • InternalNewImpl_
  • InternalGenerateClassData_

These improvements provide better arena allocation and message lifecycle management.


274-354: Added table-driven parsing support

Successfully implemented the new table-driven parsing infrastructure with the TcParseTable, which significantly improves parsing performance in Protobuf 6.30.2.


355-383: Updated Clear() implementation

The Clear() method has been properly updated to use:

  • Thread sanitizer annotations
  • Presence bit checking
  • Conditional field clearing based on has_bits
  • Memory-efficient bulk clearing

This approach is more efficient and safer than the previous implementation.


384-477: Modernized serialization

The _InternalSerialize method has been properly updated to:

  • Support both custom vtable and standard implementations
  • Check presence bits before serializing fields
  • Skip serializing zero-valued fields where appropriate
  • Use absl::bit_cast for floating point zero checks

These changes optimize serialization by avoiding unnecessary work.


478-548: Optimized size calculation

ByteSizeLong has been updated with:

  • Support for custom vtable implementations
  • Prefetching hints for better cache utilization
  • Presence bit checks for conditional size calculation
  • Zero-value checks for numeric fields

This improves performance when calculating message sizes.


549-614: Enhanced message merging logic

The MergeImpl method is properly updated with:

  • Arena-aware message field handling
  • Conditional merging based on presence bits
  • Proper handling of empty strings
  • Proper updating of has_bits after merging

These changes ensure correct behavior when merging messages.


623-641: Updated swap implementation

InternalSwap has been enhanced to:

  • Check arena compatibility
  • Swap has_bits to maintain field presence information
  • Use arena-aware string pointer swaps
  • Use efficient memory swapping for primitive fields

This provides better performance and correctness when swapping messages.


642-653: Modern metadata retrieval

GetMetadata now uses the new class data infrastructure via GetMetadataImpl, which is more efficient than the previous approach.

agents/grpc/src/proto/nsolid_service.pb.cc (12)

1-5: Successfully updated to Protobuf C++ 6.30.2

The file has been properly regenerated with the new Protobuf version, as indicated by the version comment.


8-22: Updated includes and modern Protobuf headers

The includes have been properly updated to work with Protobuf 6.30.2, adding important headers like generated_message_tctable_impl.h for the table-driven parsing infrastructure.


24-27: Modernized namespace usage

Properly switched from Protobuf namespace macros to explicit namespace references using aliases, improving code readability and maintainability.


29-113: Upgraded to modern Protobuf implementation architecture

Successfully implemented the new Protobuf architecture with:

  • Arena-aware constructors and internal Impl_ struct
  • Constant initialization support
  • Modern layout with has_bits for field presence tracking
  • Comprehensive descriptor tables for reflection

These changes improve memory management and performance.


209-250: Updated object lifecycle management

Modern Protobuf method implementations for:

  • PlacementNew_
  • InternalNewImpl_
  • InternalGenerateClassData_

These improvements provide better arena allocation and message lifecycle management.


251-286: Added table-driven parsing support

Successfully implemented the new table-driven parsing infrastructure with the TcParseTable, which significantly improves parsing performance in Protobuf 6.30.2.


287-300: Updated Clear() implementation

The Clear() method has been properly updated to use:

  • Thread sanitizer annotations
  • Presence bit checking for has_bits
  • Conditional string clearing based on presence

This approach is more efficient and safer than the previous implementation.


302-334: Modernized serialization

The _InternalSerialize method has been properly updated to:

  • Support both custom vtable and standard implementations
  • Check presence bits before serializing fields
  • Use proper stream writing for the error_message field

These changes optimize serialization by avoiding unnecessary work.


336-362: Optimized size calculation

ByteSizeLong has been updated with:

  • Support for custom vtable implementations
  • Proper presence bit checking for fields
  • Conditional size calculation based on field presence

This improves performance when calculating message sizes.


364-384: Enhanced message merging logic

The MergeImpl method is properly updated with:

  • Conditional merging based on presence bits
  • Proper handling of empty strings
  • Updating has_bits after merging

These changes ensure correct behavior when merging messages.


394-401: Updated swap implementation

InternalSwap has been enhanced to:

  • Check arena compatibility
  • Swap has_bits to maintain field presence information
  • Use arena-aware string pointer swaps

This provides better performance and correctness when swapping messages.


413-417: Added proper static initialization

The static initialization logic ensures descriptors are properly registered at startup, which is important for reflection and serialization.

agents/grpc/src/proto/metrics.pb.cc (13)

1-5: Successfully updated to Protobuf C++ 6.30.2

The file has been properly regenerated with the new Protobuf version, as indicated by the version comment.


8-22: Updated includes and modern Protobuf headers

The includes have been properly updated to work with Protobuf 6.30.2, adding important headers like generated_message_tctable_impl.h for the table-driven parsing infrastructure.


24-27: Modernized namespace usage

Properly switched from Protobuf namespace macros to explicit namespace references using aliases, improving code readability and maintainability.


29-79: Upgraded to modern Protobuf implementation architecture for both message types

Successfully implemented the new Protobuf architecture for both MetricsBody and MetricsEvent with:

  • Arena-aware constructors and internal Impl_ structs
  • Constant initialization support
  • Modern memory layout
  • Thread safety annotations

These changes improve memory management and threading safety.


215-239: Updated object lifecycle management for MetricsBody

Modern Protobuf method implementations for:

  • PlacementNew_
  • InternalNewImpl_ with arena offset encoding
  • InternalGenerateClassData_

These improvements provide better arena allocation and message lifecycle management.


269-303: Added table-driven parsing support for MetricsBody

Successfully implemented the new table-driven parsing infrastructure with the TcParseTable, which significantly improves parsing performance in Protobuf 6.30.2.


304-313: Updated Clear() implementation for MetricsBody

The Clear() method has been properly updated to use:

  • Thread sanitizer annotations
  • Proper clearing of the resource_metrics repeated field
  • Proper clearing of metadata

This approach is more efficient and safer than the previous implementation.


489-519: Updated object lifecycle management for MetricsEvent

Modern Protobuf method implementations for:

  • PlacementNew_
  • InternalNewImpl_
  • InternalGenerateClassData_

These improvements provide better arena allocation and message lifecycle management.


530-572: Added table-driven parsing support for MetricsEvent

Successfully implemented the new table-driven parsing infrastructure with the TcParseTable, which significantly improves parsing performance in Protobuf 6.30.2.


573-593: Updated Clear() implementation for MetricsEvent

The Clear() method has been properly updated to use:

  • Thread sanitizer annotations
  • Presence bit checking
  • Conditional clearing of message fields based on has_bits

This approach is more efficient and safer than the previous implementation.


666-696: Enhanced message merging logic for MetricsEvent

The MergeImpl method is properly updated with:

  • Arena-aware message field handling
  • Conditional merging based on presence bits
  • Proper submessage merging or copy construction
  • Proper updating of has_bits after merging

These changes ensure correct behavior when merging messages.


706-716: Updated swap implementation for MetricsEvent

InternalSwap has been enhanced to:

  • Check for same arena requirement
  • Swap has_bits to maintain field presence information
  • Use efficient memory swapping for message pointers

This provides better performance and correctness when swapping messages.


728-732: Added proper static initialization

The static initialization logic ensures descriptors are properly registered at startup, which is important for reflection and serialization.

agents/grpc/src/proto/metrics.pb.h (13)

1-8: Successfully updated to Protobuf C++ 6.30.2

The file has been properly regenerated with the new Protobuf version, as indicated by the version comment and updated include guard.


14-19: Added version compatibility check

Added important version compatibility check that ensures the runtime version matches the generated code version, preventing subtle compatibility issues.


20-38: Updated includes and modern Protobuf headers

The includes have been properly updated to work with Protobuf 6.30.2, adding important headers like generated_message_tctable_decl.h and explicit port definition handling.


39-66: Modernized namespace and descriptor declarations

Updates include:

  • Explicit namespace declarations
  • Extern "C" linkage for descriptor table
  • Modern class data declarations
  • GetAnyMessageName template support

These changes improve compatibility and reflection capabilities.


79-111: Updated MetricsBody class declaration

Modern class declaration includes:

  • Inheritance from google::protobuf::Message
  • PROTOBUF_FINAL destructor
  • Arena-aware constructors
  • Custom vtable support
  • Proper move and copy semantics

These changes improve memory management and provide better API safety.


112-120: Enhanced unknown fields handling

Updated unknown fields accessors with:

  • ABSL_ATTRIBUTE_LIFETIME_BOUND annotations
  • Explicit nullability
  • Modern template usage

This improves memory safety and forward compatibility.


135-149: Modernized swap methods

Updated swap methods with:

  • Arena compatibility checking via CanUseInternalSwap
  • Explicit nullability annotations
  • Safe arena checking in UnsafeArenaSwap

These changes prevent subtle memory errors when swapping messages.


152-167: Updated core Message interface methods

Core methods updated with:

  • Arena-aware New implementation
  • Modern MergeFrom/CopyFrom approach
  • Simplified IsInitialized that always returns true
  • ABSL_ATTRIBUTE_REINITIALIZES for Clear

These changes align with modern Protobuf best practices.


191-217: Updated internal class structure and lifecycle methods

Modern implementation includes:

  • Arena-aware SharedCtor/SharedDtor
  • InternalSwap for efficient swapping
  • Friend declarations for internal Protobuf templates
  • Arena-aware constructors with const references
  • PlacementNew_ and InternalNewImpl_ for allocation

These changes improve memory safety and performance.


241-268: Enhanced Impl_ struct with modern features

The internal Impl_ struct now includes:

  • Constexpr constructors
  • Arena visibility control
  • cached_size field
  • Thread sanitizer declarations
  • Proper copy semantics

This provides better threading safety and memory management.


511-548: Updated MetricsBody field accessors

Field accessors are modernized with:

  • Thread sanitizer annotations
  • ABSL_ATTRIBUTE_LIFETIME_BOUND annotations
  • Explicit nullability
  • Clear separation between internal and external accessors

These changes improve safety and memory management.


553-625: Enhanced MetricsEvent::common field accessors and mutators

Field accessors and mutators improved with:

  • Presence bit checking with PROTOBUF_ASSUME
  • Thread sanitizer annotations
  • Arena-aware pointer management
  • Safe handling of nullptr
  • Proper lifetime annotations

These changes provide better memory safety and performance.


681-723: Enhanced MetricsEvent::body field accessors and mutators

Release and setter methods improved with:

  • Proper presence bit clearing
  • Conditional arena duplication
  • Debug harness checking
  • Thread sanitizer annotations
  • Arena ownership transfer safety

These changes prevent memory leaks and use-after-free errors.

agents/grpc/src/proto/exit.pb.h (11)

1-19: Version update to Protobuf 6.30.2 looks good

The file header now correctly includes the Protobuf C++ version declaration and appropriate version checks. The include guards have also been modernized to a simpler form.


20-36: Modern Protobuf headers included correctly

The updated include directives now reference the latest Protobuf headers, including new ones like generated_message_tctable_decl.h and message_lite.h. The port definition is also properly included at the end as required by best practices.


40-73: Explicit namespace usage improves readability

The code now uses explicit google::protobuf namespaces instead of macro-based namespace usage, which is more maintainable and less error-prone.


82-199: Enhanced class implementation with modern Protobuf patterns

The Error class now properly implements:

  • Thread sanitizer annotations for safety
  • Arena-aware constructors and memory management
  • Move semantics with CanMoveWithInternalSwap
  • Explicit presence tracking via bitfields
  • Modern reflection and metadata support

These changes improve memory safety and performance.

Also applies to: 205-219


225-290: Accessor methods modernized with presence tracking

The accessor methods for the Error class fields now:

  • Properly track presence bits
  • Include thread sanitizer annotations
  • Support forwarding references and variadic templates
  • Use PROTOBUF_NONNULL/PROTOBUF_NULLABLE annotations for better pointer safety

These improvements ensure thread safety and memory correctness.


326-359: Class data structure modernized

The implementation now includes:

  • Parse tables for efficient parsing
  • Internal friend classes for TcParser integration
  • TSAN thread sanitizer declarations
  • Arena-aware memory management structures

These changes align with modern Protobuf implementation practices.


749-876: String field handling improved with safety checks

String accessors and mutators now:

  • Set presence bits on mutation
  • Include debug hardening for default strings
  • Handle arena ownership correctly
  • Add thread sanitizer annotations

These improvements enhance memory safety and thread safety for string fields.


882-904: Primitive type field handling modernized

The code now properly tracks presence bits for primitive fields like code and includes thread sanitizer annotations for all internal accesses.


906-1002: Message field handling improved with better memory management

Message field accessors and mutators now:

  • Properly handle arena ownership transfers
  • Use PROTOBUF_ASSUME for consistency checks
  • Include debug hardening for release operations
  • Set presence bits consistently

This ensures proper memory management for complex embedded message fields.


1073-1262: Message field handling consistent across complex types

The implementation of message field handling for common and body fields is consistent with other message fields, ensuring uniform memory management throughout the codebase.


1274-1277: Include guard properly closed with undef

The file correctly includes port_undef.inc and closes the include guard, following Protobuf best practices.

agents/grpc/src/proto/asset.pb.h (9)

1-19: Version update to Protobuf 6.30.2 consistent with other files

The file header includes the correct Protobuf C++ version declaration (6.30.2) matching the version seen in exit.pb.h, ensuring version consistency across the codebase.


20-38: Required Protobuf headers included in consistent order

The include directives follow the same pattern as in exit.pb.h, with proper ordering and inclusion of all necessary headers for the latest Protobuf version.


75-219: Asset class updated with consistent memory management patterns

The Asset class implementation follows the same modernization patterns seen in other classes:

  • Arena-aware constructors and memory management
  • Thread sanitizer annotations
  • Modern reflection and metadata support
  • Consistent class data structure

This ensures uniform implementation across the protobuf-generated codebase.


325-360: Parse table structure matches latest Protobuf practices

The internal parse table structure is correctly defined with the appropriate parameters for the Asset message, consistent with other message definitions in the codebase.


380-471: Common field handling follows thread-safe patterns

The implementation of the common field accessors and mutators includes all necessary thread safety annotations and arena-aware memory management, consistent with the implementation in exit.pb.h.


497-588: Metadata field handling implements proper memory ownership transfer

The handling of the metadata field (Struct type) correctly implements:

  • Proper arena ownership transfer
  • Thread sanitizer annotations
  • Presence bit tracking
  • Memory leak prevention

This ensures safe interaction with the Google Protobuf Struct type.


590-653: String field handling consistent with other files

The implementation of string field handling for the data field matches the patterns seen in exit.pb.h, ensuring consistent string management across the codebase.


654-750: Primitive field accessors consistently implement presence tracking

All primitive field accessors (complete, duration, start_ts, end_ts) consistently implement presence bit tracking and thread sanitizer annotations, matching the patterns in other fields.


761-764: Include guard properly closed with undef

The file correctly includes port_undef.inc and closes the include guard, following the same pattern as in exit.pb.h.

Comment on lines +15 to +18
#include "google/protobuf/descriptor.h"
#include "google/protobuf/generated_message_reflection.h"
#include "google/protobuf/reflection_ops.h"
#include "google/protobuf/wire_format.h"
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify that exact version 6.30.2 is available in your build environment

The protobuf version check has been updated to require exactly version 6.30.2. This strict dependency could cause build issues if different versions are used.

Run the following to verify that the required protobuf version is available in your build environment:


🏁 Script executed:

#!/bin/bash
# Check if the protobuf version 6.30.2 is installed in the system
find /usr -name "runtime_version.h" -type f 2>/dev/null | xargs grep -l "PROTOBUF_VERSION" | xargs grep -l "6030002" || echo "Required version not found in standard locations"

# Check if the version in the vendored copy matches
find . -path "*/google/protobuf/runtime_version.h" -type f | xargs grep -l "PROTOBUF_VERSION" | xargs grep "6030002" || echo "Required version not found in vendored copy"

Length of output: 359


Vendored Protobuf Version Confirmed

The vendored google/protobuf/runtime_version.h defines PROTOBUF_OSS_VERSION as 6030002 (6.30.2), whereas no matching version was found in /usr. To avoid build failures on environments that don’t have Protobuf 6.30.2 installed system-wide, please ensure that:

  • Your build configuration (e.g., include-path ordering in CMake or Bazel) prioritizes the vendored google/protobuf headers and library over any system installation.
  • The project documentation or README clearly states that Protobuf 6.30.2 is required and, if desired, how to install it system-wide.

No code changes are strictly necessary in exit.pb.cc, but updating build settings or docs will prevent surprises when a different Protobuf version is present.

@@ -1,721 +1,894 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider dropping generated code or updating the banner

The comment "NO CHECKED-IN PROTOBUF GENCODE" suggests this generated file should not be checked into the repository. Consider either:

  1. Removing it from the repository and generating it during the build process, or
  2. Updating the banner if the project policy has changed to allow generated code

@santigimeno santigimeno force-pushed the santi/protobuf_grpc_otel_cpp_updaters branch from c360a9c to b5c04ac Compare May 7, 2025 13:39
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

♻️ Duplicate comments (9)
agents/grpc/src/proto/common.pb.cc (1)

2-2: Consider updating or removing the "NO CHECKED-IN PROTOBUF GENCODE" banner

The comment on line 2 explicitly states that protobuf generated code should not be checked in, but this PR is updating numerous .pb.cc and .pb.h files. If project policy has changed to allow or require checking in generated protobuf code, consider updating the code generation templates to remove this banner or clarify the policy.

agents/grpc/src/proto/exit.pb.cc (1)

2-2: Same "NO CHECKED-IN PROTOBUF GENCODE" issue as previously identified

As noted in previous reviews, the protobuf generated files contain a banner indicating they shouldn't be committed, but project policy appears to have changed. Consider updating the protoc templates used in the build process to remove or update this banner.

agents/grpc/src/proto/common.pb.h (1)

2-2: Note regarding the checked-in generated code

The comment "NO CHECKED-IN PROTOBUF GENCODE" suggests a policy against checking in generated protobuf code, yet this file is included in the PR. This is consistent with similar comments in other protobuf files.

agents/grpc/src/proto/nsolid_service.pb.cc (1)

2-2: Note regarding the checked-in generated code

The comment "NO CHECKED-IN PROTOBUF GENCODE" suggests a policy against checking in generated protobuf code, yet this file is included in the PR.

agents/grpc/src/proto/metrics.pb.cc (1)

2-2: Note regarding the checked-in generated code

The comment "NO CHECKED-IN PROTOBUF GENCODE" suggests a policy against checking in generated protobuf code, yet this file is included in the PR.

agents/grpc/src/proto/command.pb.cc (1)

2-2: Generated code comment contradicts inclusion in repository.

The comment "NO CHECKED-IN PROTOBUF GENCODE" indicates these files should not be tracked in version control, yet they're being updated in this PR.

You should either:

  1. Remove this warning comment if these files must be committed (and document why)
  2. Remove these generated files from version control and generate them during build

This issue was previously raised in a review comment and should be addressed to maintain consistency in your codebase policies.

agents/grpc/src/proto/metrics.pb.h (1)

2-2: Same "NO CHECKED-IN PROTOBUF GENCODE" comment found in this generated file.

Like the other protobuf files, this comment contradicts the file's inclusion in version control.

For consistency across the codebase, the same approach should be applied to all protobuf-generated files.

agents/grpc/src/proto/nsolid_service.pb.h (1)

2-2: Generated protobuf header still contains "NO CHECKED-IN PROTOBUF GENCODE" comment.

This contradicts the inclusion of the file in the repository.

This issue was previously noted for this file as well, indicating a systematic inconsistency that should be addressed for all protobuf-generated files in the codebase.

agents/grpc/src/proto/exit.pb.h (1)

2-2: Same "NO CHECKED-IN PROTOBUF GENCODE" comment found in this file.

This comment contradicts the practice of checking in and updating these generated files.

This inconsistency exists in all protobuf-generated files in this PR and should be addressed systematically. Please choose one approach (either remove the comments or remove the files from version control) and apply it consistently.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad4b2a8 and b5c04ac.

📒 Files selected for processing (23)
  • agents/grpc/src/grpc_agent.cc (2 hunks)
  • agents/grpc/src/proto/asset.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/asset.pb.cc (2 hunks)
  • agents/grpc/src/proto/asset.pb.h (2 hunks)
  • agents/grpc/src/proto/blocked_loop.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/command.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/command.pb.cc (5 hunks)
  • agents/grpc/src/proto/command.pb.h (8 hunks)
  • agents/grpc/src/proto/common.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/common.pb.cc (4 hunks)
  • agents/grpc/src/proto/common.pb.h (2 hunks)
  • agents/grpc/src/proto/exit.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/exit.pb.cc (4 hunks)
  • agents/grpc/src/proto/exit.pb.h (3 hunks)
  • agents/grpc/src/proto/info.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/metrics.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/metrics.pb.cc (3 hunks)
  • agents/grpc/src/proto/metrics.pb.h (1 hunks)
  • agents/grpc/src/proto/nsolid_service.grpc.pb.h (2 hunks)
  • agents/grpc/src/proto/nsolid_service.pb.cc (2 hunks)
  • agents/grpc/src/proto/nsolid_service.pb.h (2 hunks)
  • agents/grpc/src/proto/packages.grpc.pb.h (1 hunks)
  • agents/grpc/src/proto/packages.pb.cc (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • agents/grpc/src/proto/command.grpc.pb.h
🚧 Files skipped from review as they are similar to previous changes (10)
  • agents/grpc/src/proto/info.grpc.pb.h
  • agents/grpc/src/proto/exit.grpc.pb.h
  • agents/grpc/src/proto/metrics.grpc.pb.h
  • agents/grpc/src/proto/packages.grpc.pb.h
  • agents/grpc/src/proto/common.grpc.pb.h
  • agents/grpc/src/proto/asset.grpc.pb.h
  • agents/grpc/src/proto/blocked_loop.grpc.pb.h
  • agents/grpc/src/grpc_agent.cc
  • agents/grpc/src/proto/nsolid_service.grpc.pb.h
  • agents/grpc/src/proto/packages.pb.cc
🧰 Additional context used
🧬 Code Graph Analysis (1)
agents/grpc/src/proto/nsolid_service.pb.cc (2)
agents/grpc/src/proto/asset.pb.cc (24)
  • Impl_ (29-41)
  • Impl_ (29-30)
  • Impl_ (165-168)
  • Impl_ (203-205)
  • Message (160-164)
  • Message (179-202)
  • _instance (53-53)
  • _impl_ (50-51)
  • SharedCtor (209-217)
  • SharedCtor (209-209)
  • SharedDtor (222-230)
  • SharedDtor (222-222)
  • MergeImpl (550-614)
  • MergeImpl (550-550)
  • ByteSizeLong (480-643)
  • ByteSizeLong (480-480)
  • ByteSizeLong (483-548)
  • ByteSizeLong (483-483)
  • _InternalSerialize (391-477)
  • _InternalSerialize (391-393)
  • void (355-383)
  • Clear (355-355)
  • GetMetadata (639-641)
  • GetMetadata (639-639)
agents/grpc/src/proto/asset.pb.h (35)
  • Impl_ (338-338)
  • Impl_ (339-341)
  • Impl_ (342-345)
  • _impl_ (185-185)
  • _internal_metadata_ (108-111)
  • PROTOBUF_NONNULL (82-85)
  • PROTOBUF_NONNULL (82-82)
  • PROTOBUF_NONNULL (132-139)
  • PROTOBUF_NONNULL (132-132)
  • PROTOBUF_NONNULL (140-144)
  • PROTOBUF_NONNULL (140-140)
  • PROTOBUF_NONNULL (190-190)
  • PROTOBUF_NULLABLE (188-188)
  • PROTOBUF_NULLABLE (234-234)
  • PROTOBUF_NULLABLE (248-248)
  • PROTOBUF_NULLABLE (249-249)
  • PROTOBUF_NULLABLE (263-263)
  • PROTOBUF_NULLABLE (264-264)
  • from (94-97)
  • from (94-94)
  • from (98-106)
  • from (98-98)
  • from (152-152)
  • from (154-154)
  • from (154-154)
  • self (189-189)
  • ByteSizeLong (173-173)
  • _InternalSerialize (168-170)
  • _InternalSerialize (174-178)
  • _InternalSerialize (181-183)
  • GetClassData (204-204)
  • void (602-607)
  • to_msg (157-158)
  • swap (131-131)
  • swap (131-131)
⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: test-tarball-linux
  • GitHub Check: coverage-linux
  • GitHub Check: coverage-linux-without-intl
  • GitHub Check: test-linux (ubuntu-24.04-arm)
  • GitHub Check: test-linux (ubuntu-24.04)
  • GitHub Check: test-macOS
  • GitHub Check: coverage-windows
🔇 Additional comments (42)
agents/grpc/src/proto/command.pb.h (1)

14-19:

Details

❓ Verification inconclusive

Strict protobuf version check may impact build environments

The header now includes a strict version check that will cause compilation errors if the runtime doesn't match protobuf 6.30.2 exactly. Ensure that:

  1. Your build system prioritizes the vendored copy of protobuf headers and library over any system installation
  2. CI environments have the correct version installed
  3. Documentation clarifies this strict dependency for developers

This is standard practice with newer protobuf versions, but worth noting for compatibility across different build environments.


🏁 Script executed:

#!/bin/bash
# Verify if vendor directories are included in include paths before system paths
find . -name "*.gyp" -o -name "*.gypi" -o -name "CMakeLists.txt" | xargs grep -l "include" | xargs grep -A 5 -B 5 "protobuf\|deps" | head -20

# Check if there are any include path ordering specifications
find . -name "*.gyp" -o -name "*.gypi" | xargs grep -l "include_dirs" | head -5 | xargs cat | grep -A 10 "include_dirs"

Length of output: 4713


Verify vendored Protobuf include path ordering to satisfy strict version check

The header agents/grpc/src/proto/command.pb.h now enforces

#if PROTOBUF_VERSION != 6030002
  #error "Protobuf C++ gencode is built with an incompatible version of…"
#endif

which will fail if a mismatched runtime is picked up. I didn’t find any include path directives for the vendored Protobuf in your gyp/gypi or CMakeLists. Please:

  • Add the vendored Protobuf include and library paths before any system installs
    • In CMakeLists.txt, call
    include_directories("${PROJECT_SOURCE_DIR}/deps/protobuf/include")
    link_directories("${PROJECT_SOURCE_DIR}/deps/protobuf/lib")
    before any system paths or find_package calls.
    • In your gyp/gypi files, add 'deps/protobuf/include' to include_dirs and vendor the matching library in your link settings.
  • Pin CI and local dev environments to Protobuf 6.30.2
  • Update your documentation/developer guide to note this strict dependency and how to configure the build
agents/grpc/src/proto/asset.pb.cc (10)

4-4: Correctly specifies Protobuf version

The file properly indicates it was generated with Protobuf C++ version 6.30.2, matching the PR objective to update protobuf to version 30.2.


6-22: Well-structured includes with proper organization

The includes have been properly organized with standard library headers first, followed by protobuf-specific headers. The "Must be included last" comment for port_def.inc follows best practices for protobuf.


24-26: Appropriate namespace aliases for better readability

The code uses concise namespace aliases (_pb, _pbi, _fl) for the protobuf namespaces, which improves readability while maintaining the full namespace path.


28-41: Modern constexpr initialization pattern

The implementation uses modern C++ constexpr initialization patterns for the Impl_ struct, which enables compile-time optimization and is consistent with protobuf 6.30.2 best practices.


145-207: Thread-safe field access with TSAN annotations

The implementation properly uses Thread Sanitizer annotations (TSanWrite) when clearing and modifying fields, which helps detect potential data races in multi-threaded environments.


231-272: Efficient compile-time class metadata generation

The code uses protobuf's modern class data generation pattern with InternalGenerateClassData_() which improves compile-time optimization and type safety.


355-383: Memory-efficient Clear implementation

The Clear method efficiently handles the clearing of different field types by checking has_bits and clearing only those fields that are set, which optimizes performance for large messages.


385-477: Optimized serialization with presence checks

The serialization code properly checks field presence using cached_has_bits and only serializes fields that are set, with additional optimizations like zero-value checks for numeric fields.


550-643: Enhanced merge implementation with arena awareness

The merge implementation correctly handles arenas for memory management and properly propagates presence bits, which is essential for correct protobuf semantics.


653-654: Proper port_undef.inc inclusion

The file correctly includes google/protobuf/port_undef.inc at the end, which is necessary to clean up any macros defined by port_def.inc.

agents/grpc/src/proto/common.pb.h (7)

14-30: Robust version compatibility check

The code properly checks the Protobuf C++ version (6.30.2) and provides helpful error messages with a URL to learn about cross-version runtime guarantees, which is important for maintaining compatibility.


140-153: Internal has_bits tracking for field presence

The implementation uses modern field presence tracking with explicit bit fields, which is more efficient than the older approach of using default values to determine field presence.


156-211: Arena-aware memory management

The code implements proper arena allocation support through arena-aware constructors, which allows for efficient memory management with less overhead in high-throughput applications.


232-243: Thread-safe accessors for numeric fields

Proper thread sanitizer annotations (TSanWrite, TSanRead) are used in the accessor methods, helping to prevent data races in multithreaded applications.


830-893: Comprehensive string field handling

The string field accessors properly handle all edge cases including empty strings, default values, and arena ownership, with appropriate lifetime annotations for better memory safety.


1029-1125: Safe message field handling with arena awareness

The implementation provides comprehensive message field management with proper arena-aware ownership transfer, deletion prevention, and null checks to avoid memory leaks or crashes.


1235-1237: Complete header guard pattern

The file properly closes the include guard at the end, maintaining consistency with standard C++ practices.

agents/grpc/src/proto/nsolid_service.pb.cc (8)

21-22: Proper port_def.inc inclusion

The file correctly marks google/protobuf/port_def.inc to be included last, which is necessary for proper macro definitions and platform compatibility.


29-35: Efficient constexpr initialization of Impl_ struct

The use of constexpr for the Impl_ constructor enables compile-time initialization and optimization, which is a good practice in modern C++.


127-143: Proper descriptor table initialization

The code correctly uses absl::once_flag for thread-safe lazy initialization of the descriptor table, which is important for efficient protobuf reflection.


209-240: Optimized message construction through PlacementNew_

The implementation provides efficient message construction with PlacementNew_ and InternalNewImpl_, which supports both arena and heap allocation in a consistent way.


287-300: Efficient Clear() implementation

The Clear() method properly handles different field types, clearing only what's necessary based on the has_bits tracking.


355-362: Optimized ByteSizeLong() calculation

The ByteSizeLong implementation efficiently calculates message size by checking presence bits first, which avoids unnecessary work for unset fields.


394-401: Arena-aware InternalSwap implementation

The InternalSwap method properly verifies arena compatibility and uses efficient swapping of fields and has_bits, which is essential for correct protobuf semantics.


413-417: Proper static initialization

The code uses appropriate attributes for initialization priority and static initialization of descriptor tables, which ensures proper startup sequence.

agents/grpc/src/proto/metrics.pb.cc (8)

28-42: Modern initialization pattern for MetricsBody::Impl_

The constexpr constructor implementation for Impl_ struct follows modern C++ best practices and enables compile-time optimization.


135-151: Thread-safe descriptor table initialization

The use of absl::once_flag ensures thread-safe lazy initialization of the descriptor table, which is important for reflection support in multithreaded environments.


159-162: Thread-safe clear_resource_metrics with TSanWrite

The clear_resource_metrics method properly uses Thread Sanitizer annotations for thread safety.


304-313: Comprehensive Clear implementation

The Clear method handles all fields and metadata appropriately, clearing only what's necessary.


364-375: Optimized repeated field ByteSizeLong calculation

The ByteSizeLong method efficiently calculates the size of repeated fields by first getting the size once and then iterating through the elements.


573-593: Efficient Clear implementation for MetricsEvent

The MetricsEvent::Clear method properly checks and clears only set fields based on has_bits, improving performance.


666-696: Arena-aware MergeImpl implementation

The MergeImpl method correctly handles arena allocation, presence bits, and nested message merging, which is essential for proper protobuf semantics.


728-732: Proper descriptor registration

The code correctly uses PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 for static initialization order and registers descriptors with AddDescriptors, ensuring reflection works correctly.

agents/grpc/src/proto/asset.pb.h (8)

4-19: Version compatibility checks properly implemented

The updated file correctly includes explicit version compatibility checks for Protobuf 6.30.2, providing clear error messages with documentation links. This ensures runtime version mismatches will be caught early.


20-37: Dependency includes properly updated

The includes have been properly modernized to support the new Protobuf 6.30.2 APIs, including arena allocation, message tables, and reflection support.


75-90: Class inheritance and construction properly updated

The Asset class has been correctly updated to inherit from ::google::protobuf::Message with proper arena-aware construction patterns and constant initialization support.


108-115: Unknown field support added

New accessors for unknown fields have been added with appropriate lifetime attributes, improving interoperability with unknown message fields.


346-356: Implementation structure modernized with has-bits tracking

The implementation structure now correctly uses _has_bits_ for field presence tracking and includes thread sanitizer declarations for thread safety.


380-471: Submessage field accessors updated with thread safety annotations

The accessors for the common field have been appropriately updated with thread sanitizer annotations and explicit has-bit tracking for thread-safe field access.


590-653: String field accessors updated with arena support

The string field accessors (for data) have been properly updated to include arena allocation support and thread safety annotations.


761-763: Port definition properly enclosed

The file correctly includes the port undefinition at the end, ensuring platform compatibility macros are properly scoped.

@@ -1,522 +1,616 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// NO CHECKED-IN PROTOBUF GENCODE
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Note regarding the checked-in generated code

The comment "NO CHECKED-IN PROTOBUF GENCODE" suggests this should not be committed, but the PR objective explicitly mentions regenerating proto files with the updated protoc. Consider documenting this exception or establishing a clear policy for when generated protobuf code should be checked in.


🏁 Script executed:

#!/bin/bash
# Check if there's a documented policy about checking in protobuf generated code

cd "$(git rev-parse --show-toplevel)" || exit
echo "Searching for documentation about protobuf generated code policy..."
grep -r --include="*.md" --include="README*" "protobuf gen" .
grep -r --include="*.md" --include="README*" "generated code" .
grep -r --include="CONTRIBUTING*" "protobuf" .

Length of output: 1648


Document exception for checked-in generated protobuf code

There isn’t an existing policy in the repo about when it’s OK to commit generated .pb.cc/.pb.h files, yet this PR explicitly checks in regenerated protobuf sources. To avoid confusion, please:

  • Update the comment at agents/grpc/src/proto/asset.pb.cc:2 to explain why this generated code is intentionally committed. e.g.:

    // NO CHECKED-IN PROTOBUF GENCODE
  • // NOTE: This file is regenerated and checked in using protoc vX.Y.Z

- Add a “Protobuf codegen” section to the repository’s main README (or CONTRIBUTING.md) covering:
- When generated proto files should be committed.
- Which tools/versions to use (e.g. `protoc vX.Y.Z`).
- Any CI checks that verify up-to-date sources.

This ensures future contributors understand why these generated files live in source control. 

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **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.

`````suggestion
// NO CHECKED-IN PROTOBUF GENCODE
// NOTE: This file is regenerated and checked in using protoc vX.Y.Z

@santigimeno santigimeno force-pushed the santi/protobuf_grpc_otel_cpp_updaters branch from b5c04ac to bc52147 Compare May 12, 2025 14:13
This is a major dependency update that includes:

* Update Protocol Buffers (protobuf) from previous version to 30.2
* Update gRPC from previous version to 1.72.0
* Add new build targets in protobuf.gyp:
  - protoc: Protocol Buffer compiler executable
  - protoc-gen-cpp: C++ code generator plugin for protoc

Infrastructure improvements:
* Add helper functions in tools/dep_updaters/utils.sh:
  - setup_protoc_environment: Configure protoc build environment
  - regenerate_proto_otel: Regenerate OpenTelemetry proto files
  - regenerate_proto_agents: Regenerate NSolid agent proto files

* Enhance updater scripts:
  - update-protobuf.sh: Improved handling of abseil-cpp dependency
  - update-grpc.sh: Streamlined update process
  - update-opentelemetry-cpp.sh: Automated proto regeneration

* Regenerate all proto files in agents/grpc/src/proto/ with updated
  protoc:
  - Updated *.pb.cc, *.pb.h, and *.grpc.pb.h files
  - Ensures compatibility with new protobuf/gRPC versions

This update ensures NSolid remains compatible with the latest protocol
buffer and gRPC implementations, improving performance and security.
@santigimeno santigimeno force-pushed the santi/protobuf_grpc_otel_cpp_updaters branch from bc52147 to f597dc8 Compare June 5, 2025 17:23
santigimeno added a commit that referenced this pull request Jun 5, 2025
This is a major dependency update that includes:

* Update Protocol Buffers (protobuf) from previous version to 30.2
* Update gRPC from previous version to 1.72.0
* Add new build targets in protobuf.gyp:
  - protoc: Protocol Buffer compiler executable
  - protoc-gen-cpp: C++ code generator plugin for protoc

Infrastructure improvements:
* Add helper functions in tools/dep_updaters/utils.sh:
  - setup_protoc_environment: Configure protoc build environment
  - regenerate_proto_otel: Regenerate OpenTelemetry proto files
  - regenerate_proto_agents: Regenerate NSolid agent proto files

* Enhance updater scripts:
  - update-protobuf.sh: Improved handling of abseil-cpp dependency
  - update-grpc.sh: Streamlined update process
  - update-opentelemetry-cpp.sh: Automated proto regeneration

* Regenerate all proto files in agents/grpc/src/proto/ with updated
  protoc:
  - Updated *.pb.cc, *.pb.h, and *.grpc.pb.h files
  - Ensures compatibility with new protobuf/gRPC versions

This update ensures NSolid remains compatible with the latest protocol
buffer and gRPC implementations, improving performance and security.

PR-URL: #303
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
@santigimeno
Copy link
Member Author

Landed in dd81b6d

@santigimeno santigimeno closed this Jun 5, 2025
@santigimeno santigimeno deleted the santi/protobuf_grpc_otel_cpp_updaters branch June 5, 2025 17:27
santigimeno added a commit that referenced this pull request Aug 25, 2025
This is a major dependency update that includes:

* Update Protocol Buffers (protobuf) from previous version to 30.2
* Update gRPC from previous version to 1.72.0
* Add new build targets in protobuf.gyp:
  - protoc: Protocol Buffer compiler executable
  - protoc-gen-cpp: C++ code generator plugin for protoc

Infrastructure improvements:
* Add helper functions in tools/dep_updaters/utils.sh:
  - setup_protoc_environment: Configure protoc build environment
  - regenerate_proto_otel: Regenerate OpenTelemetry proto files
  - regenerate_proto_agents: Regenerate NSolid agent proto files

* Enhance updater scripts:
  - update-protobuf.sh: Improved handling of abseil-cpp dependency
  - update-grpc.sh: Streamlined update process
  - update-opentelemetry-cpp.sh: Automated proto regeneration

* Regenerate all proto files in agents/grpc/src/proto/ with updated
  protoc:
  - Updated *.pb.cc, *.pb.h, and *.grpc.pb.h files
  - Ensures compatibility with new protobuf/gRPC versions

This update ensures NSolid remains compatible with the latest protocol
buffer and gRPC implementations, improving performance and security.

PR-URL: #303
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
santigimeno added a commit that referenced this pull request Aug 26, 2025
This is a major dependency update that includes:

* Update Protocol Buffers (protobuf) from previous version to 30.2
* Update gRPC from previous version to 1.72.0
* Add new build targets in protobuf.gyp:
  - protoc: Protocol Buffer compiler executable
  - protoc-gen-cpp: C++ code generator plugin for protoc

Infrastructure improvements:
* Add helper functions in tools/dep_updaters/utils.sh:
  - setup_protoc_environment: Configure protoc build environment
  - regenerate_proto_otel: Regenerate OpenTelemetry proto files
  - regenerate_proto_agents: Regenerate NSolid agent proto files

* Enhance updater scripts:
  - update-protobuf.sh: Improved handling of abseil-cpp dependency
  - update-grpc.sh: Streamlined update process
  - update-opentelemetry-cpp.sh: Automated proto regeneration

* Regenerate all proto files in agents/grpc/src/proto/ with updated
  protoc:
  - Updated *.pb.cc, *.pb.h, and *.grpc.pb.h files
  - Ensures compatibility with new protobuf/gRPC versions

This update ensures NSolid remains compatible with the latest protocol
buffer and gRPC implementations, improving performance and security.

PR-URL: #303
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: #359
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
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.

4 participants