chore(codecs): centralize events_dropped emission for batch encoding errors#25199
chore(codecs): centralize events_dropped emission for batch encoding errors#25199
events_dropped emission for batch encoding errors#25199Conversation
…rors Move events_dropped emission from individual internal events inside serializers to a single wrapper in (Transformer, BatchEncoder)::encode_input. This ensures all batch encoding error paths (Arrow IPC and Parquet) consistently emit events_dropped without requiring each new error path to remember to add it. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Covers the build_record_batch ArrowJsonDecode error path where a schema expects int64 but the event contains a string value. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2caa7428ec
ℹ️ 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".
…nting Replace EncoderWriteError with a direct ComponentEventsDropped emission in the batch encode wrapper. EncoderWriteError was incrementing component_errors_total and logging "Failed writing bytes." which double-counted errors (codec-specific events already increment component_errors_total) and was misleading (the failure was encoding, not writing). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0def5bf25
ℹ️ 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".
Move ComponentEventsDropped and UNINTENTIONAL imports inside the cfg(feature = "codecs-arrow") impl block to avoid unused import errors when the feature is disabled. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
events_dropped emission for batch encoding errors
Summary
After #25156 (Parquet encoding) landed,
events_droppedemission across batch encoding error paths is inconsistent -- Parquet covers most paths but misses some, Arrow IPC covers almost none. Every new error path requires the author to remember to add emission manually, which is easy to miss.This PR moves
events_droppedemission to a single wrapper at the batch encoding chokepoint (encode_input), so all current and future error paths are covered automatically. Individual internal events keep their error logs andcomponent_errors_totalcounters for diagnostics.Risk: The
non_log_countpartial drop in Parquet (non-log events filtered before encoding) can double-count if the batch also fails to encode. This is a rare intersection and acceptable.Vector configuration
Used to verify metrics across three error scenarios. Base config (swap
batch_encodingand schema file per scenario):How did you test this PR?
make check-clippy-- cleancargo nextest run -p codecs --features arrow,parquet-- 277 passedcargo nextest run --package vector --lib sinks::aws_s3-- 2 passedcargo nextest run --package vector --lib sinks::clickhouse-- 29 passedcargo nextest run --package vector --lib sinks::util::encoding-- 10 passedEvents droppedandcomponent_errors_total:Scenario 1 -- Strict mode (extra field rejected)
Schema:
message logs { required binary message (STRING); }Scenario 2 -- Null constraint violation (required field missing)
Schema:
message logs { required binary message (STRING); required binary nonexistent_field (STRING); }Scenario 3 -- Type mismatch (string field vs int64 schema)
Schema:
message logs { required int64 message; }This is a
build_record_batchArrowJsonDecodeerror that previously had zeroevents_droppedemission. Now covered by the centralized wrapper.Change Type
Is this a breaking change?
Does this PR include user facing changes?
no-changeloglabel to this PR.References