Commit bea811a
fix(webapp): don't count dropped batches as successful inserts in metrics
Devin caught this: when #insertWithJsonParseRecovery drops a batch
(sanitizer no-op, or sanitize-retry still hit a parse error),
#insertTaskRunInserts was previously converting `{kind: "dropped"}` to
`undefined`, so #insertWithRetry saw `[null, undefined]` (no error) and
#flushBatch ticked `_taskRunsInsertedCounter` / `_payloadsInsertedCounter`
for rows that never landed in ClickHouse.
Fix: return the recovery wrapper's outcome straight through. #flushBatch
now reads the outcome and only increments the success counter when both
`!err` AND `outcome?.kind !== "dropped"`. Matches the pattern in
ClickhouseEventRepository where the caller explicitly bails on
`outcome.kind === "dropped"` before downstream success work.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 8957a01 commit bea811a
1 file changed
Lines changed: 10 additions & 8 deletions
Lines changed: 10 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
677 | 677 | | |
678 | 678 | | |
679 | 679 | | |
680 | | - | |
| 680 | + | |
681 | 681 | | |
682 | 682 | | |
683 | 683 | | |
| |||
686 | 686 | | |
687 | 687 | | |
688 | 688 | | |
689 | | - | |
| 689 | + | |
690 | 690 | | |
691 | 691 | | |
692 | 692 | | |
| |||
695 | 695 | | |
696 | 696 | | |
697 | 697 | | |
698 | | - | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
699 | 703 | | |
700 | 704 | | |
701 | | - | |
| 705 | + | |
702 | 706 | | |
703 | 707 | | |
704 | 708 | | |
| |||
872 | 876 | | |
873 | 877 | | |
874 | 878 | | |
875 | | - | |
| 879 | + | |
876 | 880 | | |
877 | 881 | | |
878 | 882 | | |
879 | 883 | | |
880 | 884 | | |
881 | | - | |
882 | 885 | | |
883 | 886 | | |
884 | 887 | | |
| |||
907 | 910 | | |
908 | 911 | | |
909 | 912 | | |
910 | | - | |
| 913 | + | |
911 | 914 | | |
912 | 915 | | |
913 | 916 | | |
914 | 917 | | |
915 | 918 | | |
916 | | - | |
917 | 919 | | |
918 | 920 | | |
919 | 921 | | |
| |||
0 commit comments