Skip to content

Expose batch decode info#150

Open
jakubdyszkiewicz wants to merge 1 commit into
kafka-protocol-rs:mainfrom
jakubdyszkiewicz:batch-decode-info
Open

Expose batch decode info#150
jakubdyszkiewicz wants to merge 1 commit into
kafka-protocol-rs:mainfrom
jakubdyszkiewicz:batch-decode-info

Conversation

@jakubdyszkiewicz

Copy link
Copy Markdown

Hey 👋

In our project that uses kafka-protocol-rs we have a use case to provide telemetry on the number of records in the record batch. Telemetry is assembled in a completely different phase than handling the records, so I cannot rely on the decoded batch. I also don't want to decode the batch twice because it's too expensive. Right now, we hacked around fn count_records(batches: &Bytes) -> i32 function that extracts record count from the batches. It would be great if, instead of decoding this info ourselves, we could just use what was already done in kafka-protocol-rs.
Exposing BatchDecodeInfo and decode_batch_info would be a nice solution for us.

@aovestdipaperino

Copy link
Copy Markdown
Contributor

It seems the maintainers don't have much time for pull requests.
I created a fork for this project in aovestdipaperino/proto-kafka (so it's a different crate) in case you might want to consider.
I already did some work there including cleanup and being important for one of the company I work tools, I can guarantee a bit more frequent PR churning.

@jakubdyszkiewicz

Copy link
Copy Markdown
Author

I'll wait until #151 is resolved.

@aovestdipaperino

Copy link
Copy Markdown
Contributor

FYI — ported to aovestdipaperino/proto-kafka (a downstream fork) at https://github.com/aovestdipaperino/proto-kafka/tree/port/upstream-150-batch-decode-info. Thanks for the work on the original.

aovestdipaperino added a commit to aovestdipaperino/proto-kafka that referenced this pull request May 19, 2026
aovestdipaperino added a commit to aovestdipaperino/proto-kafka that referenced this pull request May 19, 2026
First documented release of this fork since the divergence from
tychedelia/kafka-protocol-rs. Bundles three upstream PR ports and a
build fix that had been outstanding.

See CHANGELOG.md for the full notes; in short:

  - security: bound Array/CompactArray decoder up-front capacity
    (upstream PR kafka-protocol-rs#152)
  - added: pub BatchDecodeInfo + RecordBatchDecoder::decode_batch_info
    for header-only telemetry (upstream PR kafka-protocol-rs#150)
  - changed: v2 record batch CRC32C now via crc-fast for CLMUL
    acceleration (upstream PR kafka-protocol-rs#155)
  - fixed: pin string git dep to rev 328939d so the build resolves
    against bytes 0.5

All three workspace crates (franz, franz_protocol, xtask) move to
0.1.1 in lockstep.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants