feat(vector sink): Add zstd compression support#24917
feat(vector sink): Add zstd compression support#24917jpds wants to merge 6 commits intovectordotdev:masterfrom
Conversation
bf87cf3 to
4131367
Compare
4131367 to
7c0577e
Compare
pront
left a comment
There was a problem hiding this comment.
LLM review findings:
-
compression now deserializes and documents the full shared Compression enum, but the vector sink only supports none, gzip, and zstd. In this PR, generated docs still expose snappy and zlib in website/cue/reference/components/sinks/generated/vector.cue (line 73), while src/sinks/vector/service.rs (line 94) rejects them at runtime. That means users can write a schema-valid config that fails only when the sink builds.
-
The new config path also accepts object syntax with level via src/serde.rs (line 238), but src/sinks/vector/service.rs (line 82) ignores the level entirely because tonic only takes a CompressionEncoding. So settings like { algorithm = "zstd", level = 3 } are accepted but ineffective.
My suggestion:
For this sink, a dedicated enum is the cleaner design because the actual capability surface is smaller than the shared Compression type:
- The vector sink only supports none, gzip, and zstd.
- It does not support zlib or snappy.
- It does not support per-codec level
|
@pront I also asked Claude about the extra compression options and it pointed out that greptimedb also has this issue: https://vector.dev/docs/reference/configuration/sinks/greptimedb_logs/#compression I'll look into why the level isn't applied. |
7c0577e to
eacbc3d
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
One last concern, the test plan states |
Enable the zstd compression feature in the tonic dependency to support zstd compression for gRPC communication in the Vector sink and source. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add support for zstd compression to the Vector sink, alongside the existing gzip compression. Changes include: - Update compression field from bool to Compression enum with backward compatibility via bool_or_compression deserializer - Support compression algorithms: "none", "gzip", "zstd" - Add validation that returns clear errors for unsupported compression types (zlib, snappy) - Apply appropriate tonic::codec::CompressionEncoding based on selected algorithm The default behavior (no compression) is unchanged, ensuring full backward compatibility with existing configurations. Resolves vectordotdev#23030 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Update the Vector source to accept zstd-compressed data in addition to gzip. This enables the source to receive and decompress data from Vector sinks using either compression algorithm, ensuring seamless interoperability. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add changelog fragment documenting the new zstd compression support in the Vector sink, including usage examples for all configuration formats (legacy boolean, string, and advanced object syntax). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
963067a to
f3c0de3
Compare
|
@pront All done. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f3c0de3044
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
The custom DecompressionAndMetrics tower layer only supported gzip, rejecting zstd requests before tonic could handle them. Add zstd support to the decompression layer and a test for the full path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The boolean compression syntax (`compression: true/false`) in the vector sink is deprecated in favour of the string syntax (`compression: "gzip"`, `compression: "none"`, etc.), to be removed in v0.57.0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f3c0de3 to
dc27966
Compare
Code looks good. Ping on this one @jpds. |
|
@pront Oh, sorry - I'd updated the description along with my "all done" reply earlier. Yes - I had. |
Summary
Add support for zstd compression to the Vector sink, alongside the existing gzip compression. Changes include:
The default behavior (no compression) is unchanged, ensuring full backward compatibility with existing configurations.
Vector configuration
How did you test this PR?
cargo test+ wedging into https://github.com/NixOS/nixpkgs/blob/master/nixos/tests/vector/caddy-clickhouse.nixChange Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Closes: #23030
Notes
@vectordotdev/vectorto reach out to us regarding this PR.pre-pushhook, please see this template.make fmtmake check-clippy(if there are failures it's possible some of them can be fixed withmake clippy-fix)make testgit merge origin masterandgit push.Cargo.lock), pleaserun
make build-licensesto regenerate the license inventory and commit the changes (if any). More details here.