Skip to content

feat(kafka source): add decompression option for producer-compressed payloads - #26024

Open
cjford wants to merge 6 commits into
vectordotdev:masterfrom
cjford:kafka-source-decompression
Open

feat(kafka source): add decompression option for producer-compressed payloads#26024
cjford wants to merge 6 commits into
vectordotdev:masterfrom
cjford:kafka-source-decompression

Conversation

@cjford

@cjford cjford commented Aug 5, 2026

Copy link
Copy Markdown

Summary

Adds decompression config option to kafka sources. This allows unwrapping of application-level (not kafka protocol-level) compression from message payloads, so that their original forms can be used for framing/decoding and downstream components. Supports gzip, zlib, and zstd algorithms, and furthermore allows optional zstd dictionary_path if one was used during compression.

On decompression failure, a component error is logged and the message skipped. Its offset is still committed so that partition consumption continues, which is consistent with existing behavior for decoding failures.

This pattern should be re-usable for other sources, but needs some wiring in each including specific failure behavior. I also explored more general alternative implementations (e.g. decompression as part of framing, separate pre-framing Decoder step), but found them not workable universally, particularly with streaming inputs.

Code generated using Claude Fable 5

Vector configuration

sources:
  in:
    type: kafka
    bootstrap_servers: localhost:9092
    group_id: vector-test
    topics: ["vector-test"]
    auto_offset_reset: beginning
    decoding:
      codec: json
    decompression:
      algorithm: zstd
      dictionary_path: /tmp/vector-test.dict

sinks:
  out:
    type: console
    inputs: [in]
    encoding:
      codec: json

How did you test this PR?

Tested manually with local (macOS aarch64) kafka/vector setup, using zstd to compress raw messages, kcat to publish them to kafka, and a console sink to verify output. Covered various scenarios:

  • Plain payload regression check
  • gzip/zlib/zstd decompression works as expected
  • zstd decompression with dictionary works as expected
  • Failed decompression skips message and commits offset
  • Multi-message payload is correctly decompressed -> framed
  • Size limits enforced for both upfront allocation and decompressed size
  • Error messaging for mismatched compression algorithms, invalid dictionary path, mismatched dictionaries, dictionary_path with unsupported algorithm

Is this a breaking change?

  • Yes
  • No

Does this PR include user facing changes?

  • Yes. Please add a changelog fragment based on our guidelines.
  • No. A maintainer will apply the no-changelog label to this PR.

References

@cjford
cjford requested review from a team as code owners August 5, 2026 04:51
@github-actions github-actions Bot added docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: sources Anything related to the Vector's sources domain: external docs Anything related to Vector's external, public documentation labels Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@cjford

cjford commented Aug 7, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

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

Labels

docs review on hold The documentation team reviews PRs only after a PR is approved by the COSE team. domain: external docs Anything related to Vector's external, public documentation domain: sources Anything related to the Vector's sources

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant