Skip to content

fix(batchrouter): report real status code and sample event for drained jobs - #7104

Merged
itsmihir merged 3 commits into
masterfrom
fix/batchrouter-reporting-status-code
Jun 22, 2026
Merged

itsmihir merged 3 commits into
masterfrom
fix/batchrouter-reporting-status-code

Conversation

@itsmihir

@itsmihir itsmihir commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

Two fixes to batch router reporting metrics for the object-storage / warehouse paths.

1. Status code flattened to 500 for drained/aborted jobs

The sync upload-result reporting path (handle.go) mapped every non-success job state to 500 via getBRTErrorCode(state), hiding the 410 (DRAIN_ERROR_CODE) that drained / retry-exhausted / warehouse-down jobs actually carry. This made aborted jobs report as 500, inconsistent with the pre-upload drain path (worker.go) and the async path (handle_async.go), which both report the real code.

getBRTErrorCode now takes the job's errorCode and prefers it: Succeeded → 200, otherwise the job's actual code (e.g. 410), falling back to 500 when unset/zero (e.g. retriable Failed). jobsdb error_code writes are unchanged — this only affects the reported status code.

2. No sample event on drain (410) metrics

The pre-upload drain path called getReportMetrics without JobsList, so jobsMap was empty and the sample event defaulted to EmptyPayload. Drained (410) reporting metrics carried no sample event. Now passes drainJobList, matching the other reporting callers.

state before (reporting) after (reporting)
Succeeded 200 200
Failed (retriable) 500 500
Aborted (drain / retry-exhausted / wh-down) 500 410
drain metric sample event empty populated

Linear Ticket

Resolves PIPE-3129

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

itsmihir and others added 2 commits June 18, 2026 17:18
…d jobs

The sync object-storage/warehouse reporting path mapped every non-success
job state to 500 via getBRTErrorCode, hiding the 410 drain/aborted code.
getBRTErrorCode now prefers the job's actual error code (e.g. 410), keeping
200 for succeeded and falling back to 500 when unset.

The pre-upload drain path also omitted JobsList when building report metrics,
so drained (410) metrics carried no sample event. Pass drainJobList so the
sample event is captured, consistent with the other reporting paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

🔒 Scanned for secrets using gitleaks 8.28.0
@itsmihir
itsmihir requested review from atzoum and ktgowtham June 18, 2026 11:52
@codecov

codecov Bot commented Jun 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.86%. Comparing base (b5435ba) to head (c7beacc).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7104      +/-   ##
==========================================
- Coverage   79.90%   79.86%   -0.04%     
==========================================
  Files         583      583              
  Lines       65273    65276       +3     
==========================================
- Hits        52155    52135      -20     
- Misses      10016    10047      +31     
+ Partials     3102     3094       -8     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@itsmihir
itsmihir requested review from fracasula and mihir20 June 22, 2026 07:47
@itsmihir
itsmihir enabled auto-merge (squash) June 22, 2026 07:48
@itsmihir
itsmihir merged commit d3fab82 into master Jun 22, 2026
161 of 167 checks passed
@itsmihir
itsmihir deleted the fix/batchrouter-reporting-status-code branch June 22, 2026 08:58
atzoum pushed a commit that referenced this pull request Jun 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.78.0-rc.1](v1.77.0...v1.78.0-rc.1)
(2026-06-22)


### Features

* add and register bq stream v2 async destination manager
([#7057](#7057))
([787b7ac](787b7ac))
* add BQSTREAM_V2 destination type and bqstreamv2 building blocks
([#7056](#7056))
([02e84e5](02e84e5))
* **batchrouter:** raise getImportingJobs max iterations and remove
payload size limit
([#7076](#7076))
([15707f6](15707f6))
* **gateway:** throttling support for internal batch endpoint
([#7055](#7055))
([6b6ba65](6b6ba65))
* **jobsdb:** introduce compaction min ds age
([#7077](#7077))
([4d6d97a](4d6d97a))
* **processor:** new intermediate jobsdb
([#7048](#7048))
([dfef1f1](dfef1f1))


### Bug Fixes

* abort non-retryable Klaviyo upload errors instead of retrying
([#7085](#7085))
([4c3e4f1](4c3e4f1))
* **batchrouter:** correlate poll results by externalId instead of
whole-row hash
([09326d2](09326d2))
* **batchrouter:** report real status code and sample event for drained
jobs ([#7104](#7104))
([d3fab82](d3fab82))
* internal endpoints enabled in open source version of rudder-server
([#7075](#7075))
([dc071cd](dc071cd))
* **jobsdb:** get jobs lateral join against the v_last view
([#7105](#7105))
([853d14c](853d14c))
* klaviyo upload partial failures
([#7107](#7107))
([37e79e9](37e79e9))
* **router:** shared barrier causing illegal job sequence errors
([#7101](#7101))
([b5435ba](b5435ba))


### Miscellaneous

* add BQSTREAM_V2 integration tests
([#7058](#7058))
([478e217](478e217))
* add rudderai announcement
([#7046](#7046))
([ff02fe8](ff02fe8))
* bump codecov-action to 7.0.0
([#7070](#7070))
([31f0623](31f0623))
* cleanup embedded warehouse transformations
([#7072](#7072))
([31f0623](31f0623))
* **deps:** bump actions/checkout from 6.0.2 to 6.0.3
([#7084](#7084))
([745d5ab](745d5ab))
* **deps:** bump aws-actions/configure-aws-credentials from 6.1.2 to
6.2.0 ([#7081](#7081))
([19251cd](19251cd))
* **jobsdb:** refactoring and cleanup
([#7043](#7043))
([2e4ea92](2e4ea92))
* remove legacy warehouse endpoints
([#7090](#7090))
([6f85153](6f85153))
* rename bqstream all events
([#7088](#7088))
([4d9ad19](4d9ad19))
* **router:** rename experimental buffer size calculator to dynamic
([#7103](#7103))
([52896cd](52896cd))
* support using the full event schema key as pulsar ordering key
([#7086](#7086))
([ff50611](ff50611))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
atzoum pushed a commit that referenced this pull request Jun 23, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.78.0](v1.77.0...v1.78.0)
(2026-06-22)


### Features

* add and register bq stream v2 async destination manager
([#7057](#7057))
([787b7ac](787b7ac))
* add BQSTREAM_V2 destination type and bqstreamv2 building blocks
([#7056](#7056))
([02e84e5](02e84e5))
* **batchrouter:** raise getImportingJobs max iterations and remove
payload size limit
([#7076](#7076))
([15707f6](15707f6))
* **gateway:** throttling support for internal batch endpoint
([#7055](#7055))
([6b6ba65](6b6ba65))
* **jobsdb:** introduce compaction min ds age
([#7077](#7077))
([4d6d97a](4d6d97a))
* **processor:** new intermediate jobsdb
([#7048](#7048))
([dfef1f1](dfef1f1))


### Bug Fixes

* abort non-retryable Klaviyo upload errors instead of retrying
([#7085](#7085))
([4c3e4f1](4c3e4f1))
* **batchrouter:** correlate poll results by externalId instead of
whole-row hash
([09326d2](09326d2))
* **batchrouter:** report real status code and sample event for drained
jobs ([#7104](#7104))
([d3fab82](d3fab82))
* internal endpoints enabled in open source version of rudder-server
([#7075](#7075))
([dc071cd](dc071cd))
* **jobsdb:** get jobs lateral join against the v_last view
([#7105](#7105))
([853d14c](853d14c))
* klaviyo upload partial failures
([#7107](#7107))
([37e79e9](37e79e9))
* **router:** shared barrier causing illegal job sequence errors
([#7101](#7101))
([b5435ba](b5435ba))


### Miscellaneous

* add BQSTREAM_V2 integration tests
([#7058](#7058))
([478e217](478e217))
* add rudderai announcement
([#7046](#7046))
([ff02fe8](ff02fe8))
* bump codecov-action to 7.0.0
([#7070](#7070))
([31f0623](31f0623))
* cleanup embedded warehouse transformations
([#7072](#7072))
([31f0623](31f0623))
* **deps:** bump actions/checkout from 6.0.2 to 6.0.3
([#7084](#7084))
([745d5ab](745d5ab))
* **deps:** bump aws-actions/configure-aws-credentials from 6.1.2 to
6.2.0 ([#7081](#7081))
([19251cd](19251cd))
* **jobsdb:** refactoring and cleanup
([#7043](#7043))
([2e4ea92](2e4ea92))
* remove legacy warehouse endpoints
([#7090](#7090))
([6f85153](6f85153))
* rename bqstream all events
([#7088](#7088))
([4d9ad19](4d9ad19))
* **router:** rename experimental buffer size calculator to dynamic
([#7103](#7103))
([52896cd](52896cd))
* support using the full event schema key as pulsar ordering key
([#7086](#7086))
([ff50611](ff50611))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: rudderstack-github-actions[bot] <236995729+rudderstack-github-actions[bot]@users.noreply.github.com>
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