Repository navigation
Conversation
A sink discards the whole batch when one event fails to encode, but the codec only reports the failing event as dropped. The remaining events are never sent and never counted, so they appear in neither component_sent_events_total nor component_discarded_events_total. Emit an EventsDropped event for the rest of the batch in both batch encoders before returning the original error. Fixes vectordotdev#27295 Generated with DeepSeek V4.1 Flash (per AI_POLICY.md agentic contribution guidance)
|
Thank you for your contribution! Before we can merge this PR, please sign our Contributor License Agreement. To sign, copy and post the phrase below as a new comment on this PR.
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
More details
The added discard count complements the codec’s existing single-event count, accounting for the entire abandoned batch while preserving error propagation. Caller inspection found no duplicate discard reporting.
🤖 Bits Code Review · Commit 0e3020e
Summary
A sink abandons the whole batch when one event fails to encode, but only the failing event was counted as discarded. The remaining events in that batch are never sent and never counted, so they show up in neither
component_sent_events_totalnorcomponent_discarded_events_total.This report the events the codec does not: after an encode failure the encoder emits an
EventsDroppedevent for the rest of the batch and then returns the original error.Fixes #27295
References
Fixes#27295Vector configuration
The configuration from the issue, which exercises the
httpsink encoder path:How did you test this PR?
Two new unit tests cover the batch encoder in
src/sinks/util/encoding.rsand thehttpsink encoder insrc/sinks/http/encoder.rs. Each builds a three-event batch whose third event exceeds the serializer's nesting limit, then asserts the discarded-events counter reaches3rather than1.Mutation check: with
emit_droppedreduced to a no-op, both tests fail withleft: Counter { value: 1.0 }against the expected3.0— the behaviour reported in the issue.cargo clippy --package vector --features sinks-http --no-default-features --all-targetsreports no findings in the changed files. It does flag a pre-existingunused_async_trait_implinsrc/sinks/http/config.rs, whose onlyawaits sit behind#[cfg(feature = "aws-core")]and so disappear in that reduced feature set.vdev check eventscould not run locally: the crate download forlibz-sysreturned HTTP 504 from the configured mirror. CI covers it.Does this PR include user facing changes?
For a new deprecation announcement, follow the deprecation policy and add a
deprecation.d/notice instead.no-changeloglabel to this PR.The fragment is
changelog.d/27295_batch_encode_discard_count.fix.md.