Skip to content

Emit RecordsFailedProcessing when the record processor throws - #1838

Merged
chenylee-aws merged 2 commits into
awslabs:masterfrom
chenylee-aws:3.x-processrecords-failure-metrics
Oct 30, 2026
Merged

chenylee-aws merged 2 commits into
awslabs:masterfrom
chenylee-aws:3.x-processrecords-failure-metrics

Conversation

@chenylee-aws

@chenylee-aws chenylee-aws commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

  • When processRecords() throws, emit a RecordsFailedProcessing metric with the number of records in that batch, at shard and application level. Since KCL doesn't retry here, it's an upper bound on records impacted by record processor failures.
  • Emit RecordsProcessed only after processRecords() returns. It was emitted before the handoff, so records in a failed batch were also counted as processed. It now counts the records delivered to the record processor (after records at or below the checkpoint are filtered out), and failed batches are counted only in RecordsFailedProcessing.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@chenylee-aws
chenylee-aws force-pushed the 3.x-processrecords-failure-metrics branch 2 times, most recently from 4025d50 to 0d6c54e Compare October 29, 2026 18:32
@chenylee-aws
chenylee-aws marked this pull request as ready for review October 29, 2026 20:38
lucienlu-aws
lucienlu-aws previously approved these changes Oct 29, 2026
@chenylee-aws
chenylee-aws force-pushed the 3.x-processrecords-failure-metrics branch from 0d6c54e to 8dc4be0 Compare October 29, 2026 22:00
@chenylee-aws
chenylee-aws force-pushed the 3.x-processrecords-failure-metrics branch from 8dc4be0 to f42434b Compare October 29, 2026 23:36
@chenylee-aws chenylee-aws changed the title Emit RecordsSkipped when the record processor throws Emit RecordsFailedProcessing when the record processor throws Oct 29, 2026
@chenylee-aws
chenylee-aws force-pushed the 3.x-processrecords-failure-metrics branch 2 times, most recently from cd93c9b to 02c10dd Compare October 29, 2026 23:41
When processRecords() throws, emit RecordsFailedProcessing with the number of records in the batch at shard and application level. KCL does not retry at this point, so it is an upper bound on records impacted by record processor failures.
RecordsProcessed was emitted before the handoff, so records in a batch where processRecords() threw were also counted as processed. Emit it after processRecords() returns. It now counts records delivered to the record processor (after checkpoint filtering), and failed batches are counted only in RecordsFailedProcessing.
@chenylee-aws
chenylee-aws force-pushed the 3.x-processrecords-failure-metrics branch from 1609f19 to 3ea5933 Compare October 29, 2026 23:59
@chenylee-aws
chenylee-aws merged commit 5dd7372 into awslabs:master Oct 30, 2026
5 of 6 checks passed
@chenylee-aws
chenylee-aws deleted the 3.x-processrecords-failure-metrics branch October 30, 2026 20:26
vincentvilo-aws pushed a commit to vincentvilo-aws/amazon-kinesis-client that referenced this pull request Nov 3, 2026

This branch is waiting to be deployed

1 waiting deployment
manual-approval — 3ea5933c Waiting Oct 30, 2026 by chenylee-aws via wait-for-approval #380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants