feat(codecs): Allow encoder to add avro schema id prefix#25351
feat(codecs): Allow encoder to add avro schema id prefix#25351YaZasnyal wants to merge 2 commits intovectordotdev:masterfrom
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20c1397ae3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| /// | ||
| /// [wire_format]: https://docs.confluent.io/platform/current/schema-registry/fundamentals/serdes-develop/index.html#wire-format | ||
| #[configurable(metadata(docs::examples = "42"))] | ||
| pub schema_id: Option<i32>, |
There was a problem hiding this comment.
Reject negative schema IDs in Avro encoder config
The new schema_id field is declared as Option<i32>, and encode writes whatever value is provided directly into the Confluent wire-format prefix. This permits negative IDs (for example -1), which do not correspond to valid Schema Registry IDs and will produce Avro payloads that downstream consumers or broker-side schema validation cannot resolve. This issue is triggered whenever a negative schema_id is configured, so the config should enforce non-negative values (for example u32 or explicit validation in build).
Useful? React with 👍 / 👎.
|
@vectordotdev, hi What do you think about adding this param? I saw another MR trying to add schema registry but it will require a huge refactoring because it introduces async calls into the sync codecs code. This feature will probably satisfy some of the users including myself. It should be forward compatible with future schema registry integration. |
Summary
This change allows to add a schema_id to avro encoded messages.
Vector configuration
How did you test this PR?
I have created a unit test for this PR and tested it locally using stdin-stdout pipeline that produced properly encoded messages.
Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References
Closes: #19872
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 on the dd-rust-license-tool.